Closed GoogleCodeExporter closed 9 years ago
Original comment by ever...@fireproofsocks.com
on 5 Dec 2012 at 4:19
Original comment by ever...@fireproofsocks.com
on 5 Dec 2012 at 4:24
I found the culprit: it's the newly added map_meta_cap property and its
checkbox.
For the quickie workaround:
1. edit your post-type definition
2. go to the Advanced tab
3. Check the "Map Meta Cap" checkbox
4. Save your post-type definition
That should get you able to edit pages normally.
I'll figure out why WP is choking on the new parameter.
Original comment by ever...@fireproofsocks.com
on 5 Dec 2012 at 4:30
Argh... this is so poorly documented. The default should be that the
map_meta_cap is checked, so I've updated that. I think once that's unchecked,
then you *must* supply a mapping in the "capabilities" field.
Original comment by ever...@fireproofsocks.com
on 5 Dec 2012 at 5:13
Actually no... the more I read of the official docs and the source code the
more I am confused. The default should be unchecked for map_meta_cap... what I
think is happening is that if it's checked and nothing is in the
"capabilities", then WP is reverting to a default argument for that (i.e. one
that works). Never mind the numerous caveats and overrides peppering the
source code that set the value to "true" in a majority of cases.
Part of the problem is that the WP functions are checking for *LITERAL* values
(e.g. a literal null or a literal false), which is a train-wreck when you're
dealing with POSTed data, because posted data is always a string. So if the
map_meta_cap is unchecked, I have to set it to be a literal null (boolean
type-casting is not enough). This is the type of immature, error-ridden and
ignorant code that makes WP impossible to work with. Truly awful architecture
here.
See the following:
* map_meta_cap() function inside of wp-includes/capabilities.php
* get_post_type_capabilities() inside of wp-includes/post.php
In order to use the map_meta_cap checkbox, you must supply a valid mapping in
the "capabilities" field, e.g.
edit_post=edit_post&read_post=read_post&edit_posts=edit_posts&publish_posts=publ
ish_posts
Here's what the raw code looks like inside of post.php
get_post_type_capabilities():
'edit_post' => 'edit_' . $singular_base,
'read_post' => 'read_' . $singular_base,
'delete_post' => 'delete_' . $singular_base,
'edit_posts' => 'edit_' . $plural_base,
'edit_others_posts' => 'edit_others_' . $plural_base,
'publish_posts' => 'publish_' . $plural_base,
'read_private_posts' => 'read_private_' . $plural_base,
Where $singular_base by default is whatever is inside the $capability_type
field (usually "post"), and $plural_base is by default this value plus an "s".
I also added functionality so you can supply alternate plurals now in the
"capability_type" field by using a comma, e.g. "nucleus,nuclei"
Committed revision 634284.
Original comment by ever...@fireproofsocks.com
on 5 Dec 2012 at 5:52
Works like a charm now. Thank you for the swift fix.
Original comment by tra...@gmail.com
on 5 Dec 2012 at 1:13
works for me too! Thank you for taking care of it so quickly!
Original comment by lisa.hol...@gmail.com
on 5 Dec 2012 at 3:47
Original issue reported on code.google.com by
tra...@gmail.com
on 5 Dec 2012 at 3:46