[wp-trac] [WordPress Trac] #26365: map_meta_cap() should use parent post status when post has a post status of inherit
WordPress Trac
noreply at wordpress.org
Mon Dec 2 19:38:49 UTC 2013
#26365: map_meta_cap() should use parent post status when post has a post status of
inherit
-----------------------------+-----------------------------
Reporter: methnen | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Role/Capability | Version: trunk
Severity: normal | Keywords:
-----------------------------+-----------------------------
When a post has a status of inherit `map_meta_cap()` fails to use the
parent's status and so logic that uses the status to determine the mapping
doesn't behave as expected.
For example `read_post()` will often fail when it should pass. Similarly
for `delete_post()` and `edit_post()`.
This has recently caused a variety of difficulties in a project I've been
working on where we have a custom post type that uses the inherit post
status on children so authors only need to manage the post status of the
main parent post.
The fix is two parts. One a fix to `get_post_status()` that causes it to
check the parent status so it'll work backwards to the first post that has
a valid (not 'inherit') post status.
The second is a fix to `map_meta_cap()` that checks for a post status of
inherit on the post object and then uses `get_post_status()` on the
post_parent id value.
A couple related/similar issues:
http://core.trac.wordpress.org/ticket/23458 (these patches would fix the
root issue)
http://core.trac.wordpress.org/ticket/17668 (fixed)
--
Ticket URL: <http://core.trac.wordpress.org/ticket/26365>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list