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:
Jeremy Felt
2018-12-14 02:14:13 +00:00
parent 93836b4fb7
commit 6a84afa33c
5 changed files with 245 additions and 0 deletions

View File

@@ -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;
}