[wp-trac] [WordPress Trac] #40197: meta cap 'publish_post' is not being used
WordPress Trac
noreply at wordpress.org
Sat Dec 12 03:37:27 UTC 2020
#40197: meta cap 'publish_post' is not being used
--------------------------------------+------------------------------
Reporter: panjmp | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Role/Capability | Version: 3.5
Severity: normal | Resolution:
Keywords: good-first-bug has-patch | Focuses: administration
--------------------------------------+------------------------------
Comment (by manfcarlo):
Here is a patch. All four post type meta capabilities are now handled
through the same code block, since there was a lot of code being
duplicated verbatim between them. The patch moves this to the bottom of
the switch block, purely to avoid a messy diff.
The patch attempts to preserve the existing behaviour as much as possible,
with two exceptions:
1. Fixed an error that was accessing non-existent `edit_page`,
`delete_page` and `read_page` properties on the post type capabilities
object, now `edit_post`, `delete_post`, `read_post` and `publish_post` are
accessed instead.
2. The `publish_post` meta capability now respects `$args['map_meta_cap']
= false` and does not map, previously it was mapping anyway.
As far as changing `publish_posts` to `publish_post`, the patch changes it
wherever there is a readily available post reference. I verified that this
successfully changes the behaviour on the post editor. Some cases,
however, (such as the Quick Edit) appear to require a deeper re-tooling to
support this meta capability, which this patch does not attempt.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40197#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list