Make WordPress Core


Ignore:
Timestamp:
10/23/2018 06:52:03 AM (8 years ago)
Author:
pento
Message:

Blocks: Add the reusable block post type, wp_block.

See #45098.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-includes/post.php

    r43744 r43804  
    225225                'supports'         => array(),
    226226        ) );
     227
     228        register_post_type(
     229                'wp_block',
     230                array(
     231                        'labels'                => array(
     232                                'name'          => __( 'Blocks'),
     233                                'singular_name' => __( 'Block' ),
     234                                'search_items'  => __( 'Search Blocks' ),
     235                        ),
     236                        'public'                => false,
     237                        '_builtin'              => true, /* internal use only. don't use this when registering your own post type. */
     238                        'show_ui'               => true,
     239                        'show_in_menu'          => false,
     240                        'rewrite'               => false,
     241                        'capability_type'       => 'block',
     242                        'capabilities' => array(
     243                                // You need to be able to edit posts, in order to read blocks in their raw form.
     244                                'read'                   => 'edit_posts',
     245                                // You need to be able to publish posts, in order to create blocks.
     246                                'create_posts'           => 'publish_posts',
     247                                'edit_published_posts'   => 'edit_published_posts',
     248                                'delete_published_posts' => 'delete_published_posts',
     249                                'edit_others_posts'      => 'edit_others_posts',
     250                                'delete_others_posts'    => 'delete_others_posts',
     251                        ),
     252                        'map_meta_cap'          => true,
     253                        'supports'              => array(
     254                                'title',
     255                                'editor',
     256                        ),
     257                )
     258        );
     259
    227260
    228261        register_post_status( 'publish', array(
Note: See TracChangeset for help on using the changeset viewer.