From 7bbee20833339fff6cb9c53c7fbba61bf48f52ac Mon Sep 17 00:00:00 2001 From: jorgefilipecosta Date: Mon, 8 Nov 2021 14:24:02 +0000 Subject: [PATCH] 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 --- src/wp-includes/post.php | 27 +++++++++++++++++++++++++++ src/wp-includes/taxonomy.php | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index 91edacf76f..841f61c77f 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -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( diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index 5b1acb4fc6..79a5bdab52 100644 --- a/src/wp-includes/taxonomy.php +++ b/src/wp-includes/taxonomy.php @@ -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,