Add: wp_global_styles custom post type.

This commit adds the wp_global_styles custom post type following the same approach used to add other core custom post types. It also updates the wp_theme taxonomy to include the wp_global_styles post type.
The post type is registered in the same way it is on the plugin we just adapt the location for the core.

See #54336.
Props oandregal.

git-svn-id: https://develop.svn.wordpress.org/trunk@52041 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
jorgefilipecosta 2021-11-08 14:24:02 +00:00
parent 1046682e4f
commit 7bbee20833
2 changed files with 28 additions and 1 deletions

View File

@ -365,6 +365,33 @@ function create_initial_post_types() {
)
);
register_post_type(
'wp_global_styles',
array(
'label' => __( 'Global Styles', 'gutenberg' ),
'description' => 'CPT to store user design tokens',
'public' => false,
'show_ui' => false,
'show_in_rest' => false,
'rewrite' => false,
'capabilities' => array(
'read' => 'edit_theme_options',
'create_posts' => 'edit_theme_options',
'edit_posts' => 'edit_theme_options',
'edit_published_posts' => 'edit_theme_options',
'delete_published_posts' => 'edit_theme_options',
'edit_others_posts' => 'edit_theme_options',
'delete_others_posts' => 'edit_theme_options',
),
'map_meta_cap' => true,
'supports' => array(
'title',
'editor',
'revisions',
),
)
);
register_post_status(
'publish',
array(

View File

@ -175,7 +175,7 @@ function create_initial_taxonomies() {
register_taxonomy(
'wp_theme',
array( 'wp_template' ),
array( 'wp_template', 'wp_global_styles' ),
array(
'public' => false,
'hierarchical' => false,