[wp-trac] [WordPress Trac] #39725: Post Type Capabilities Broken

WordPress Trac noreply at wordpress.org
Tue Apr 18 17:02:23 UTC 2017


#39725: Post Type Capabilities Broken
-------------------------------+---------------------------------
 Reporter:  michael.ecklund    |       Owner:
     Type:  defect (bug)       |      Status:  closed
 Priority:  normal             |   Milestone:
Component:  Posts, Post Types  |     Version:  4.7.2
 Severity:  normal             |  Resolution:  invalid
 Keywords:                     |     Focuses:  ui, administration
-------------------------------+---------------------------------

Comment (by michael.ecklund):

 Replying to [comment:2 johnbillion]:

 That doesn't seem to have resolved the problem. Still seeing PHP Notices
 everywhere.

 The Codex must be incorrect then. The Codex demonstrates using those
 capabilities.

 https://codex.wordpress.org/Function_Reference/register_post_type#Arguments



 > Thanks for the ticket, @michael.ecklund.
 >
 > I narrowed down the problem to the existence of three meta capabilities
 in your `capabilities` array:
 >
 > {{{
 > $args['capabilities']['edit_post']   = 'edit_post';
 > $args['capabilities']['read_post']   = 'do_not_allow';
 > $args['capabilities']['delete_post'] = 'do_not_allow';
 > }}}
 >
 > These are singular form meta capabilities, which shouldn't be defined in
 your capabilities array. They map to the `edit_posts`, `read_posts`, and
 `delete_posts` primitive capabilities respectively. If you remove these
 from your capabilities array, the functionality you're attempting to
 create appears to work as expected.
 >
 > Let me know if this works for you.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39725#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list