mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Blocks: Add the reusable block post type, wp_block.
Merges [43804] from the 5.0 branch to trunk. See #45098. git-svn-id: https://develop.svn.wordpress.org/trunk@44146 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -574,6 +574,23 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
return call_user_func_array( 'map_meta_cap', $args );
|
||||
}
|
||||
|
||||
// Block capabilities map to their post equivalent.
|
||||
$block_caps = array(
|
||||
'edit_blocks',
|
||||
'edit_others_blocks',
|
||||
'publish_blocks',
|
||||
'read_private_blocks',
|
||||
'delete_blocks',
|
||||
'delete_private_blocks',
|
||||
'delete_published_blocks',
|
||||
'delete_others_blocks',
|
||||
'edit_private_blocks',
|
||||
'edit_published_blocks',
|
||||
);
|
||||
if ( in_array( $cap, $block_caps, true ) ) {
|
||||
$cap = str_replace( '_blocks', '_posts', $cap );
|
||||
}
|
||||
|
||||
// If no meta caps match, return the original cap.
|
||||
$caps[] = $cap;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user