I'm creating a custom post type and have added categories taxanomy. This can be done in two ways:

// In $args array
'taxonomies' => array('category'),

// or calling a function
register_taxonomy_for_object_type( 'category', 'my_custom_post_type_name' );

In both cases, an additional child-menu item appears in my custom post menu in the left admin menu.

Categories are already showing under Post menu, so I don't need it to display again. Any way of preventing this?


This was hacked together very quickly. I don't for sure if there will be problems with translation, but I be there would be.

function remove_menu_from_cpt() {
  global $submenu;
  $post_type = 'book';
  $tax_slug = 'post_tag';
  if (isset($submenu['edit.php?post_type='.$post_type])) {
    foreach ($submenu['edit.php?post_type='.$post_type] as $k => $sub) {
      if (false !== strpos($sub[2],$tax_slug)) {

It used the 'book' post type and post tags, because that was convenient for me to test, but it pretty obvious what needs to change to make this work for your case-- I believe you need:

$post_type = 'my_custom_post_type_name';
$tax_slug = 'category';

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.