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

@@ -252,6 +252,38 @@ function create_initial_post_types() {
)
);
register_post_type(
'wp_block',
array(
'labels' => array(
'name' => __( 'Blocks' ),
'singular_name' => __( 'Block' ),
'search_items' => __( 'Search Blocks' ),
),
'public' => false,
'_builtin' => true, /* internal use only. don't use this when registering your own post type. */
'show_ui' => true,
'show_in_menu' => false,
'rewrite' => false,
'capability_type' => 'block',
'capabilities' => array(
// You need to be able to edit posts, in order to read blocks in their raw form.
'read' => 'edit_posts',
// You need to be able to publish posts, in order to create blocks.
'create_posts' => 'publish_posts',
'edit_published_posts' => 'edit_published_posts',
'delete_published_posts' => 'delete_published_posts',
'edit_others_posts' => 'edit_others_posts',
'delete_others_posts' => 'delete_others_posts',
),
'map_meta_cap' => true,
'supports' => array(
'title',
'editor',
),
)
);
register_post_status(
'publish',
array(