Make WordPress Core


Ignore:
Timestamp:
12/14/2018 02:14:13 AM (8 years ago)
Author:
jeremyfelt
Message:

Blocks: Add the reusable block post type, wp_block.

Merges [43804] from the 5.0 branch to trunk.

See #45098.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-includes/post.php

    r44110 r44146  
    250250                        'delete_with_user' => false,
    251251                        'supports'         => array(),
     252                )
     253        );
     254
     255        register_post_type(
     256                'wp_block',
     257                array(
     258                        'labels'          => array(
     259                                'name'          => __( 'Blocks' ),
     260                                'singular_name' => __( 'Block' ),
     261                                'search_items'  => __( 'Search Blocks' ),
     262                        ),
     263                        'public'          => false,
     264                        '_builtin'        => true, /* internal use only. don't use this when registering your own post type. */
     265                        'show_ui'         => true,
     266                        'show_in_menu'    => false,
     267                        'rewrite'         => false,
     268                        'capability_type' => 'block',
     269                        'capabilities'    => array(
     270                                // You need to be able to edit posts, in order to read blocks in their raw form.
     271                                'read'                   => 'edit_posts',
     272                                // You need to be able to publish posts, in order to create blocks.
     273                                'create_posts'           => 'publish_posts',
     274                                'edit_published_posts'   => 'edit_published_posts',
     275                                'delete_published_posts' => 'delete_published_posts',
     276                                'edit_others_posts'      => 'edit_others_posts',
     277                                'delete_others_posts'    => 'delete_others_posts',
     278                        ),
     279                        'map_meta_cap'    => true,
     280                        'supports'        => array(
     281                                'title',
     282                                'editor',
     283                        ),
    252284                )
    253285        );
Note: See TracChangeset for help on using the changeset viewer.