-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not register global styles CPT in WordPress 5.9 #37282
Conversation
* | ||
* This has been ported to src/wp-includes/post.php | ||
*/ | ||
function register_global_styles_custom_post_type() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code of this function is the same, just indented.
* | ||
* @return void | ||
*/ | ||
function maybe_register_global_styles_custom_post_type() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was gutenberg_experimental_is_site_editor_available
which I've removed and substituted by direct calls to wp_is_block_theme
in the plugin.
* @return void | ||
*/ | ||
function maybe_register_global_styles_custom_post_type() { | ||
if ( wp_is_block_theme() ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not wrong on Core we don't care about this, we always register the CPT. We might do the same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right, we don't.
function register_global_styles_custom_post_type() { | ||
$args = array( | ||
'label' => __( 'Global Styles', 'gutenberg' ), | ||
'description' => 'Global styles to include in themes.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a second commit, I actually updated this text to be in line with core's naming.
Follow-up to #36978
This PR makes sure we only register the global styles Custom Post Type in environments other than WordPress 5.9. It moves some more code to
lib/compat/wordpress-5.9
.How to test
The expected result is that everything worked as expected and there were no errors due to the CPT not being registered.