Set map_meta_cap to true when capability_type = post and no custom caps are specified. see #14122.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e8af3af849
commit
3ccfb56e3c
|
@ -883,7 +883,7 @@ function register_post_type($post_type, $args = array()) {
|
||||||
// Args prefixed with an underscore are reserved for internal use.
|
// Args prefixed with an underscore are reserved for internal use.
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'labels' => array(), 'description' => '', 'publicly_queryable' => null, 'exclude_from_search' => null,
|
'labels' => array(), 'description' => '', 'publicly_queryable' => null, 'exclude_from_search' => null,
|
||||||
'capability_type' => 'post', 'capabilities' => array(), 'map_meta_cap' => false,
|
'capability_type' => 'post', 'capabilities' => array(), 'map_meta_cap' => null,
|
||||||
'_builtin' => false, '_edit_link' => 'post.php?post=%d', 'hierarchical' => false,
|
'_builtin' => false, '_edit_link' => 'post.php?post=%d', 'hierarchical' => false,
|
||||||
'public' => false, 'rewrite' => true, 'has_archive' => false, 'query_var' => true,
|
'public' => false, 'rewrite' => true, 'has_archive' => false, 'query_var' => true,
|
||||||
'supports' => array(), 'register_meta_box_cb' => null,
|
'supports' => array(), 'register_meta_box_cb' => null,
|
||||||
|
@ -916,6 +916,13 @@ function register_post_type($post_type, $args = array()) {
|
||||||
if ( null === $args->exclude_from_search )
|
if ( null === $args->exclude_from_search )
|
||||||
$args->exclude_from_search = !$args->public;
|
$args->exclude_from_search = !$args->public;
|
||||||
|
|
||||||
|
// Back compat with quirky handling in version 3.0. #14122
|
||||||
|
if ( 'post' == $args->capability_type && null === $args->map_meta_cap && empty( $args->capabilities ) )
|
||||||
|
$args->map_meta_cap = true;
|
||||||
|
|
||||||
|
if ( null === $args->map_meta_cap )
|
||||||
|
$args->map_meta_cap = false;
|
||||||
|
|
||||||
$args->cap = get_post_type_capabilities( $args );
|
$args->cap = get_post_type_capabilities( $args );
|
||||||
unset($args->capabilities);
|
unset($args->capabilities);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue