[wp-trac] [WordPress Trac] #30991: Post type object capability 'delete_posts' is referenced in the posts list table but does not exist unless 'map_meta_cap' is set to true for post type

WordPress Trac noreply at wordpress.org
Tue Nov 22 14:29:42 UTC 2016


#30991: Post type object capability 'delete_posts' is referenced in the posts list
table but does not exist unless 'map_meta_cap' is set to true for post type
------------------------------------+-----------------------------
 Reporter:  bamadesigner            |       Owner:  SergeyBiryukov
     Type:  defect (bug)            |      Status:  reviewing
 Priority:  normal                  |   Milestone:  Future Release
Component:  Posts, Post Types       |     Version:  4.1
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:  administration
------------------------------------+-----------------------------

Comment (by xedin.unknown):

 Weird, unexplained behaviour observed in plugin.

 We've had a CPT definition in the code that has remained almost unchanged
 for years. This definition did not have neither the  `map_meta_cap =>
 true`, nor `capabilities` explicitly defined. However, neither us nor the
 client ever experienced (or at least never reported) the symptoms of this
 issue. Recently, I changed that definition to include the `capabilities`
 index, with one element: `create_posts`. The symptom naturally presented.
 Upon changing back (entirely removing `capabilities` from the array), the
 symptom persisted. Begs the questions:

 1. Our plugin is used by 40k+ people. The CPT definition is obviously
 wrong. Why didn't the symptoms ever present?
 2. Why did the symptoms present now?
 3. Why didn't they go away when code changes were reverted?
 4. Is this some sort of caching (I didn't find any in the DB)? If so, why
 didn't it work with the original CPT definition, but now works with the
 changed one?
 5. If this is the result of some caching, where did it get a working CPT
 definition from? The symptoms do not present on a fresh WP install.

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


More information about the wp-trac mailing list