See the capability_type
and capabilities
arguments for register_post_type
.
You can pass the capabilities
argument an array of capabilities to map to the necessary caps, here’s an example of the args array with custom capabilities.
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capabilities' => array(
'publish_posts' => 'ADD_CAP_HERE',
'edit_posts' => 'ADD_CAP_HERE',
'edit_others_posts' => 'ADD_CAP_HERE',
'delete_posts' => 'ADD_CAP_HERE',
'delete_others_posts' => 'ADD_CAP_HERE',
'read_private_posts' => 'ADD_CAP_HERE',
'edit_post' => 'ADD_CAP_HERE',
'delete_post' => 'ADD_CAP_HERE',
'read_post' => 'ADD_CAP_HERE',
),
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','editor','thumbnail')
);
You’d of course replace ADD_CAP_HERE
with a capability. If you wanted to limit this post type to admins, simply use a capability only admins have, such as manage_options
.
Table of roles and their caps(for quick reference).
http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table