Skip to content

Commit 3471404

Browse files
committed
Make CPT registration unconditional
1 parent e4ecc6b commit 3471404

1 file changed

Lines changed: 59 additions & 61 deletions

File tree

src/wp-includes/post.php

Lines changed: 59 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -310,67 +310,65 @@ function create_initial_post_types() {
310310
)
311311
);
312312

313-
if ( current_theme_supports( 'block-templates' ) ) {
314-
register_post_type(
315-
'wp_template',
316-
array(
317-
'labels' => array(
318-
'name' => __( 'Templates' ),
319-
'singular_name' => __( 'Template' ),
320-
'menu_name' => _x( 'Templates', 'Admin Menu text' ),
321-
'add_new' => _x( 'Add New', 'Template' ),
322-
'add_new_item' => __( 'Add New Template' ),
323-
'new_item' => __( 'New Template' ),
324-
'edit_item' => __( 'Edit Template' ),
325-
'view_item' => __( 'View Template' ),
326-
'all_items' => __( 'All Templates' ),
327-
'search_items' => __( 'Search Templates' ),
328-
'parent_item_colon' => __( 'Parent Template:' ),
329-
'not_found' => __( 'No templates found.' ),
330-
'not_found_in_trash' => __( 'No templates found in Trash.' ),
331-
'archives' => __( 'Template archives' ),
332-
'insert_into_item' => __( 'Insert into template' ),
333-
'uploaded_to_this_item' => __( 'Uploaded to this template' ),
334-
'filter_items_list' => __( 'Filter templates list' ),
335-
'items_list_navigation' => __( 'Templates list navigation' ),
336-
'items_list' => __( 'Templates list' ),
337-
),
338-
'description' => __( 'Templates to include in your theme.' ),
339-
'public' => false,
340-
'has_archive' => false,
341-
'show_ui' => false,
342-
'show_in_menu' => false,
343-
'show_in_admin_bar' => false,
344-
'show_in_rest' => true,
345-
'rewrite' => false,
346-
'rest_base' => 'templates',
347-
'rest_controller_class' => 'WP_REST_Templates_Controller',
348-
'capability_type' => array( 'template', 'templates' ),
349-
'capabilities' => array(
350-
'create_posts' => 'edit_theme_options',
351-
'delete_posts' => 'edit_theme_options',
352-
'delete_others_posts' => 'edit_theme_options',
353-
'delete_private_posts' => 'edit_theme_options',
354-
'delete_published_posts' => 'edit_theme_options',
355-
'edit_posts' => 'edit_theme_options',
356-
'edit_others_posts' => 'edit_theme_options',
357-
'edit_private_posts' => 'edit_theme_options',
358-
'edit_published_posts' => 'edit_theme_options',
359-
'publish_posts' => 'edit_theme_options',
360-
'read' => 'edit_theme_options',
361-
'read_private_posts' => 'edit_theme_options',
362-
),
363-
'map_meta_cap' => true,
364-
'supports' => array(
365-
'title',
366-
'slug',
367-
'excerpt',
368-
'editor',
369-
'revisions',
370-
),
371-
)
372-
);
373-
}
313+
register_post_type(
314+
'wp_template',
315+
array(
316+
'labels' => array(
317+
'name' => __( 'Templates' ),
318+
'singular_name' => __( 'Template' ),
319+
'menu_name' => _x( 'Templates', 'Admin Menu text' ),
320+
'add_new' => _x( 'Add New', 'Template' ),
321+
'add_new_item' => __( 'Add New Template' ),
322+
'new_item' => __( 'New Template' ),
323+
'edit_item' => __( 'Edit Template' ),
324+
'view_item' => __( 'View Template' ),
325+
'all_items' => __( 'All Templates' ),
326+
'search_items' => __( 'Search Templates' ),
327+
'parent_item_colon' => __( 'Parent Template:' ),
328+
'not_found' => __( 'No templates found.' ),
329+
'not_found_in_trash' => __( 'No templates found in Trash.' ),
330+
'archives' => __( 'Template archives' ),
331+
'insert_into_item' => __( 'Insert into template' ),
332+
'uploaded_to_this_item' => __( 'Uploaded to this template' ),
333+
'filter_items_list' => __( 'Filter templates list' ),
334+
'items_list_navigation' => __( 'Templates list navigation' ),
335+
'items_list' => __( 'Templates list' ),
336+
),
337+
'description' => __( 'Templates to include in your theme.' ),
338+
'public' => false,
339+
'has_archive' => false,
340+
'show_ui' => false,
341+
'show_in_menu' => false,
342+
'show_in_admin_bar' => false,
343+
'show_in_rest' => true,
344+
'rewrite' => false,
345+
'rest_base' => 'templates',
346+
'rest_controller_class' => 'WP_REST_Templates_Controller',
347+
'capability_type' => array( 'template', 'templates' ),
348+
'capabilities' => array(
349+
'create_posts' => 'edit_theme_options',
350+
'delete_posts' => 'edit_theme_options',
351+
'delete_others_posts' => 'edit_theme_options',
352+
'delete_private_posts' => 'edit_theme_options',
353+
'delete_published_posts' => 'edit_theme_options',
354+
'edit_posts' => 'edit_theme_options',
355+
'edit_others_posts' => 'edit_theme_options',
356+
'edit_private_posts' => 'edit_theme_options',
357+
'edit_published_posts' => 'edit_theme_options',
358+
'publish_posts' => 'edit_theme_options',
359+
'read' => 'edit_theme_options',
360+
'read_private_posts' => 'edit_theme_options',
361+
),
362+
'map_meta_cap' => true,
363+
'supports' => array(
364+
'title',
365+
'slug',
366+
'excerpt',
367+
'editor',
368+
'revisions',
369+
),
370+
)
371+
);
374372

375373
register_post_status(
376374
'publish',

0 commit comments

Comments
 (0)