[wp-hackers] Custom Post Type + Capabilities & Roles

Andrew Nacin wp at andrewnacin.com
Fri Jun 25 21:34:53 UTC 2010


On Fri, Jun 25, 2010 at 5:20 PM, Joaquin Rodriguez Montero <
yojoaquin at gmail.com> wrote:

> 'capability_type' => 'question',
>
> Therefore I created a user role and add those caps:
>
> add_role( 'questions_writer', 'Questions Writer',
>
> array('read,question,edit_question,publish_question,read_question,delete_question'));


Please see get_post_type_capabilities() in wp-includes/post.php to see how
capabilities get generated from the capability_type. You're missing the
plural aspect.

Also, don't give meta capabilities like edit_question to a role. Those get
re-mapped depending on context to the primitive capabilities, like
edit_questions, edit_published_questions, etc.


More information about the wp-hackers mailing list