categories - Why custom taxomony not showing when create a post?

admin2025-06-02  4

I have created taxomony which are showing in wordpress Menubar in Post tab. But when i create a new post or edit my post it is not showing with categories. Can any one help me out that where i am wrong.

Functions.php

add_action( 'init', 'register_taxonomy_Emerates_State' );

function register_taxonomy_Emerates_State() {
    $labels = array( 
    'name' => _x( 'Emerates_State', 'State' ),
    'singular_name' => _x( 'Emerates_State', 'State' ),
    'search_items' => _x( 'Search Emerates_State', 'State' ),
    'popular_items' => _x( 'Popular Emerates_State', 'State' ),
    'all_items' => _x( 'All Emerates_State', 'State' ),
    'parent_item' => _x( 'Parent Emerates_State', 'State' ),
    'parent_item_colon' => _x( 'Parent Emerates_State:', 'State' ),
    'edit_item' => _x( 'Edit Emerates_State', 'State' ),
    'update_item' => _x( 'Update Emerates_State', 'State' ),
    'add_new_item' => _x( 'Add New Emerates_State', 'State' ),
    'new_item_name' => _x( 'New Emerates_State', 'State' ),
    'separate_items_with_commas' => _x( 'Separate Emerates_State with commas', 'State' ),
    'add_or_remove_items' => _x( 'Add or remove Emerates_State', 'State' ),
    'choose_from_most_used' => _x( 'Choose from the most used Emerates_State', 'State' ),
    'menu_name' => _x( 'Emerates_State', 'State' ),
);

$args = array( 
    'labels' => $labels,
    'public' => true,
    'show_in_nav_menus' => true,
    'show_ui' => true,
    'show_tagcloud' => false,
    'show_admin_column' => true,
    'hierarchical' => true,
    'with_front'=> true,
    'query_var' => true,
    'has_archive' => true,
    'rewrite' => array( 'slug' => 'state' )
);

register_taxonomy( 'State', array('post'), $args );
}

See Images:

I have created taxomony which are showing in wordpress Menubar in Post tab. But when i create a new post or edit my post it is not showing with categories. Can any one help me out that where i am wrong.

Functions.php

add_action( 'init', 'register_taxonomy_Emerates_State' );

function register_taxonomy_Emerates_State() {
    $labels = array( 
    'name' => _x( 'Emerates_State', 'State' ),
    'singular_name' => _x( 'Emerates_State', 'State' ),
    'search_items' => _x( 'Search Emerates_State', 'State' ),
    'popular_items' => _x( 'Popular Emerates_State', 'State' ),
    'all_items' => _x( 'All Emerates_State', 'State' ),
    'parent_item' => _x( 'Parent Emerates_State', 'State' ),
    'parent_item_colon' => _x( 'Parent Emerates_State:', 'State' ),
    'edit_item' => _x( 'Edit Emerates_State', 'State' ),
    'update_item' => _x( 'Update Emerates_State', 'State' ),
    'add_new_item' => _x( 'Add New Emerates_State', 'State' ),
    'new_item_name' => _x( 'New Emerates_State', 'State' ),
    'separate_items_with_commas' => _x( 'Separate Emerates_State with commas', 'State' ),
    'add_or_remove_items' => _x( 'Add or remove Emerates_State', 'State' ),
    'choose_from_most_used' => _x( 'Choose from the most used Emerates_State', 'State' ),
    'menu_name' => _x( 'Emerates_State', 'State' ),
);

$args = array( 
    'labels' => $labels,
    'public' => true,
    'show_in_nav_menus' => true,
    'show_ui' => true,
    'show_tagcloud' => false,
    'show_admin_column' => true,
    'hierarchical' => true,
    'with_front'=> true,
    'query_var' => true,
    'has_archive' => true,
    'rewrite' => array( 'slug' => 'state' )
);

register_taxonomy( 'State', array('post'), $args );
}

See Images:

Share Improve this question asked Mar 17, 2019 at 10:12 Jamal AhmadJamal Ahmad 1032 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

It looks like you're using the new Block Editor (Gutenberg).

In such case, you should know that this editor is based on REST. So if you want to see your custom taxonomy in this editor, you have to make it visible in rest.

You should set show_in_rest parameter to true.

$args = array( 
    'labels' => $labels,
    'public' => true,
    'show_in_nav_menus' => true,
    'show_ui' => true,
    'show_tagcloud' => false,
    'show_admin_column' => true,
    'hierarchical' => true,
    'with_front'=> true,
    'query_var' => true,
    'has_archive' => true,
    'rewrite' => array( 'slug' => 'state' ),
    'show_in_rest' => true
);
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748799397a313816.html

最新回复(0)