Reputation: 207
can anybody help me this my question how to allow simple user like author in wp to add custom post type in wp-admin? Thanks
Upvotes: 1
Views: 360
Reputation: 438
Basically you can pass this "capabilities" parameter while registering your custom post type :
...,
'capabilities' => array(
'publish_posts' => 'read',
'edit_posts' => 'read',
'edit_others_posts' => 'edit_others_posts',
'delete_posts' => 'delete_posts',
'delete_others_posts' => 'delete_others_posts',
'read_private_posts' => 'read',
'edit_post' => 'read',
'delete_post' => 'read',
'read_post' => 'read',
),
...
Assuming that a "suscriber" has just the read capability, he will then be able to access the CPT menu in the admin, list all the CPTs, ...
But this may not be very safe because the read capability has nothing to do with what the suscriber will actually do.
It may be better to create a new capability bunch as it's described in WordPress documentation (http://codex.wordpress.org/Function_Reference/register_post_type).
You can find a very helpful post if you want to create more accurate capabilities on a per post basis.
Upvotes: 1