function my_function_name() {
$labels = array(
............
);
$args = array(
......
'capability_type' => 'post',
'capabilities' => array(
'create_posts' => false, // Removes support for the "Add New" function (use 'do_not_allow' instead of false for multisite set ups)
),
'map_meta_cap' => true, // Set to `false`, if users are not allowed to edit/delete existing posts
);
register_post_type( 'my_function_name', $args );
}
add_action( 'init', 'my_function_name', 0 );
There is a meta capability "create_posts" that is not documented but is used by WordPress to check before inserting the various "Add New" buttons and links.
In the Custom Post Type declaration, add "capabilities" (not to be confused with cap) and then set it to false as above.
In the Custom Post Type declaration, add "capabilities" (not to be confused with cap) and then set it to false as above.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.