Blocks: Add the reusable block post type, wp_block.

Merges [43804] from the 5.0 branch to trunk.

See #45098.

Built from https://develop.svn.wordpress.org/trunk@44146


git-svn-id: http://core.svn.wordpress.org/trunk@43976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Jeremy Felt
2018-12-14 02:15:37 +00:00
parent 9bbc000c65
commit 3af9743b81
4 changed files with 55 additions and 1 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;
}