-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Update function names for the public global styles API functions #36907
Merged
Conversation
This file contains 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
By doing this, we offer a stable way for plugins to get access to global styles data, no matter the WordPress version they're using (e.g. WordPress 5.8) or whether the plugin is active or not.
oandregal
requested review from
spacedmonkey and
TimothyBJacobs
as code owners
November 26, 2021 11:07
oandregal
added
Backport to WP 6.7 Beta/RC
Pull request that needs to be backported to the WordPress major release that's currently in beta
Global Styles
Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
labels
Nov 26, 2021
youknowriad
approved these changes
Nov 26, 2021
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 makes sense.
Makes me wonder what Global Styles and FSE code is remaining outside compat/wordpress-5.9
folder that we should move.
Created #36913 to do the same for a couple of other functions. |
noisysocks
removed
the
Backport to WP 6.7 Beta/RC
Pull request that needs to be backported to the WordPress major release that's currently in beta
label
Nov 29, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Global Styles
Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
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 #34843 and #36610
This PR updates the names of the public functions to access global styles data. It substitutes the
gutenberg_*
prefix with thewp_*
one.Changes
Before, we had:
gutenberg_get_global_settings
,gutenberg_get_global_styles
andgutenberg_get_global_stylesheet
.wp_get_global_settings
,wp_get_global_styles
,wp_get_global_stylesheet
.After, we have:
wp_get_global_settings
,wp_get_global_styles
,wp_get_global_stylesheet
, both in Gutenberg and WordPress 5.9.Why we need to do this
By doing this, we fix two issues:
We make the
wp_*
functions available in all WordPress versions supported by the plugin (e.g. WordPress 5.8). These are expected to be used by 3rd parties and we can't have them to change betweengutenberg_*
orwp_*
depending on the environment.We align these with the rationale laid out for how the
lib/compat/wordpress-X.X
code should work. This is meant to minimize the backport efforts by having in this folder code with the same name as core and checking forfunction_exist
. This way, once the minimum version of the plugin is updated, we just can remove the folder completely and Gutenberg will work nicely, without any other change.