[wp-hackers] Custom post type capabilities, but needs 'edit_posts' as well?

Alex Hempton-Smith hempsworth at gmail.com
Wed Jun 30 00:05:59 UTC 2010


I added a custom post type, and designated the role of 'manage_finances' as
the required capability. You would therefore expect that any user with the
cap of 'manage_finances' would be able to view the post types screen and add
more.

Instead, I have to grant them 'edit_posts' and 'delete_posts' for them to
even create draft custom posts, which gives them access to the regular posts
and comments screens.

Wouldn't it be more flexible to possibly have an extended array in
the register_post_type() args, like this:

$args = array(
 'capabilities' => array(
 'edit_posts' => 'add_finances',
 'delete_posts' => 'add_finances',
 'delete_published_posts' => 'manage_finances'
 ),
 'rewrite' => false ...

etc etc

So you could specify which roles were required for each aspect of the custom
post type, because they are currently treated the same as regular posts in
WP and the admin panel.

-- Alex  (Hempsworth)


More information about the wp-hackers mailing list