Block Bindings: Fix panel not appearing in custom post types.
There is a bug where the attributes panel is not shown in custom post types. This is caused because each post type can define a capability_type, which by default is post, so the logic to map the capabilities wasn't correct and it was returning false. Props santosguillamot, cbravobernal. Fixes #62226. Built from https://develop.svn.wordpress.org/trunk@59239 git-svn-id: http://core.svn.wordpress.org/trunk@58631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4988a70658
commit
f3e8c615c8
|
@ -825,8 +825,13 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
|
|||
$caps[] = 'do_not_allow';
|
||||
break;
|
||||
}
|
||||
|
||||
$caps = map_meta_cap( "edit_{$object_subtype}", $user_id, $object_id );
|
||||
$post_type_object = get_post_type_object( $object_subtype );
|
||||
// Initialize empty array if it doesn't exist.
|
||||
if ( ! isset( $post_type_object->capabilities ) ) {
|
||||
$post_type_object->capabilities = array();
|
||||
}
|
||||
$post_type_capabilities = get_post_type_capabilities( $post_type_object );
|
||||
$caps = map_meta_cap( $post_type_capabilities->edit_post, $user_id, $object_id );
|
||||
break;
|
||||
default:
|
||||
// Handle meta capabilities for custom post types.
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.7-beta3-59238';
|
||||
$wp_version = '6.7-beta3-59239';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue