i am using wordpress custom post and register_taxonomy bellow is my code .

function epg_works_register() {
    $labels = array(
        'name' => __('Works'),
        'singular_name' => __('Works'),
        'add_new' => __('Add Works Item'),
        'add_new_item' => __('Add New Works Item'),
        'edit_item' => __('Edit Works Item'),
        'new_item' => __('New Works Item'),
        'view_item' => __('View Works Item'),
        'search_items' => __('Search Works Item'),
        'not_found' => __('No Works Items found'),
        'not_found_in_trash' => __('No Works Items found in Trash'),
        'parent_item_colon' => '',
        'menu_name' => __('Works')
    // Set other options for Custom Post Type

    $args = array(
        'labels'              => $labels,
        // Features this CPT supports in Post Editor
        'supports'            => array( 'title', 'editor'),

        /* A hierarchical CPT is like Pages and can have
        * Parent and child items. A non-hierarchical CPT
        * is like Posts.
        'hierarchical'        => true,
        'public' => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'menu_position'       => 5,
        'can_export'          => true,
        'has_archive'         => true,
        'exclude_from_search' => true,
        'publicly_queryable'  => true,
        'capability_type'     => 'post',

    // Registering your Custom Post Type
    register_post_type( 'works', $args );

    register_taxonomy('works_category', 'works', array('hierarchical' => true, 'label' => 'Works Category', 'query_var' => true, 'rewrite' => array('slug' => 'works-categorys')));

add_action( 'init', 'epg_works_register');

if i am changeing register_taxonomy('works_category' to register_taxonomy('something ') it's show on http://localhost/wp-admin/nav-menus.php

but if used register_taxonomy('works_category') then i can't see anything there http://localhost/wp-admin/nav-menus.php.

What's wrong ?



The only thing that I see is the argument 'query_var'=>true, it can be set to false, but the default value is the taxonomy name, so set it to true is maybe the cause of the failure, even the codex example set it to true, I think it can be great to try

                'hierarchical' => true, 
                'label' => 'Works Category', 
                'query_var' => 'works_category', 
                'rewrite' => array('slug' => 'works-categorys')

Or just suppress query_var from the array ?

| improve this answer | |
  • it's working fine With new installation of wordpress . but not working with my OLD DATA – Saiful Islam Dec 2 '16 at 19:28
  • May be problem with old taxonomy data ! is there any way to reset register_taxonomy ? – Saiful Islam Dec 2 '16 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.