Do not register global styles CPT in WordPress 5.9#37282
Merged
Conversation
oandregal
commented
Dec 10, 2021
| * | ||
| * This has been ported to src/wp-includes/post.php | ||
| */ | ||
| function register_global_styles_custom_post_type() { |
Member
Author
There was a problem hiding this comment.
The code of this function is the same, just indented.
oandregal
commented
Dec 10, 2021
| * | ||
| * @return void | ||
| */ | ||
| function maybe_register_global_styles_custom_post_type() { |
Member
Author
There was a problem hiding this comment.
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.
youknowriad
reviewed
Dec 10, 2021
| * @return void | ||
| */ | ||
| function maybe_register_global_styles_custom_post_type() { | ||
| if ( wp_is_block_theme() ) { |
Contributor
There was a problem hiding this comment.
If I'm not wrong on Core we don't care about this, we always register the CPT. We might do the same here.
oandregal
commented
Dec 10, 2021
| function register_global_styles_custom_post_type() { | ||
| $args = array( | ||
| 'label' => __( 'Global Styles', 'gutenberg' ), | ||
| 'description' => 'Global styles to include in themes.', |
Member
Author
There was a problem hiding this comment.
In a second commit, I actually updated this text to be in line with core's naming.
youknowriad
approved these changes
Dec 10, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.