Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

Is there any way to disable the option of adding a new post under a Custom Post Type in WordPress (3.0)? I've looked into labels and arguments but can't find anything that would resemble such a feature.

1 Answer

0 votes
by (106k points)

If you want to disable the option of adding a new post under a Custom Post Type in WordPress (3.0) then there is a meta capability create_posts that is used by WordPress to check before inserting the various 'Add New' buttons and links but this is not documented. You can see the code below:-

register_post_type( 'custom_post_type_name', array(

  'capability_type' => 'post',

  'capabilities' => array(

     'create_posts' => 'do_not_allow',), 

     'map_meta_cap' => true, 

    ));

Related questions

0 votes
1 answer
asked Aug 6, 2019 in Web Technology by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...