When editing categories for my custom post type the selected admin menu is the one for posts (see screenshot). Is this a bug. If not it’s kind of non intuitive, and not so good for the end users experience.
Code:
function product_register_product_post_type() {
$box_post_type_args = array(
'show_ui' => true,
'public' => true,
'taxonomies' => array(
'product_category'
),
'supports' => array(
'title',
'editor',
'thumbnail',
'slug'
),
'labels' => array(
'name' => 'Products',
'singular_name' => 'Product',
'add_new' => 'Add New Product',
'add_new_item' => 'Add New Product',
'edit_item' => 'Edit Product',
'new_item' => 'New Product',
'view_item' => 'View Product',
'search_items' => 'Search Products',
'not_found' => 'No Products Found',
'not_found_in_trash' => 'No Products Found In Trash'
),
'capability_type' => 'page',
'rewrite' => array( 'slug' => 'produkt' )
);
register_post_type( 'product', $box_post_type_args );
// Add new taxonomy, make it hierarchical (like categories)
$labels = array(
'name' => _x( 'Categories', 'taxonomy general name' ),
'singular_name' => _x( 'Category', 'taxonomy singular name' ),
'search_items' => __( 'Search Category' ),
'all_items' => __( 'All Categories' ),
'parent_item' => __( 'Parent Category' ),
'parent_item_colon' => __( 'Parent Category:' ),
'edit_item' => __( 'Edit Category' ),
'update_item' => __( 'Update Category' ),
'add_new_item' => __( 'Add New Category' ),
'new_item_name' => __( 'New Genre Category' ),
'menu_name' => __( 'Categories' ),
);
register_taxonomy( 'product_category', array( 'product' ), array(
'public' => true,
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'produkter' ),
));
}
add_action( 'init', 'product_register_product_post_type');
You need to set up a custom taxonomy and then add the name of the custom tax via the “taxonomies” arg when registering the custom post type.
Perhaps because you named your custom taxonomy “Categories”?
…
Try changing the values in your
$labels
array that you pass toregister_taxonomy
.