0

I would like to hide the "add new" button from my custom post type. I tried doing this : (from this answer)

    'capability_type'       => array('place', 'places'),
    'capabilities' => array(
        'create_posts' => 'false',
    'map_meta_cap'        => true,

This works fine and it hides the button, however I am not allowed to access my custom post types any more. I would like to be able to only edit private posts but not be able to publish or create.

If I try to access to my private post by copy/past the url, it works. But listing(or reading) the posts doesn't work.

My question is, am I even allowed to edit my private posts and access them if I can't create_posts ? It seems that in order to read or list the posts I need to have access to "edit_posts" before. I am getting confused any help will be much appreciated.

  • Do you want to just remove Add New admin menu of your custom post type? Could you please share your whole code? – Vinod Dalvi May 12 '17 at 5:00
  • I found the problem, I had "$role->remove_cap( 'edit_posts' );" somewhere and this blocked me from listing the custom posts. Cuz I also wanted to hide wp default posts for the role. – Mohamed Salem Lamiri May 12 '17 at 10:01

Your Answer

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

Browse other questions tagged or ask your own question.