I'm trying to add new custom capability so I can hide custom post type from non admins. In my custom post type I have some custom taxonomies and then 2 submenus. The administrator can see the menu of the custom post type, the taxonomies and the submenus, but other users can only see the submenus. But when I try to apply the add_role on the activation hook the submenus are not shown. I also tried with add_cap and the same happens. I also tried to add capabilities in the custom post type and then just the taxonomies were shown. I don't know what I'm doing wrong. Any ideas?

EDIT: As requested in the comment, this is how I add the 2 submenus:

     function bsp_plugin_menu(){
add_submenu_page('edit.php?post_type=badge', 'Add new student', 'Add new students', 'manage-options','add-new-students','bsp_add_new_students');
add_submenu_page('edit.php?post_type=badge', 'Show students', 'Show students', 'manage_options','show-students','bsp_students_show');   
  • Please share how you are adding the submenus (code excerpt).
    – ambroseya
    Commented May 27, 2015 at 14:56
  • I edited the question with requested code. @ambroseya
    – dea
    Commented May 27, 2015 at 15:08

1 Answer 1


So to answer my question... I don't know if it is the best approach: In the custom post type I added capabilities to which only admin has priviliges like so:


And then I also did that for custom taxonomies like so:


So only admin can see it and manage it. For the submenu in the capability parameter I just entered the capability which administrator, editor and author have in common (publish_posts).

add_submenu_page('edit.php?post_type=badge', 'Add new student', 'Add new students', 'publish_posts','add-new-students','bsp_add_new_students');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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