-
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
Update hook's names from global_styles_*
to theme_json_*
#44159
Update hook's names from global_styles_*
to theme_json_*
#44159
Conversation
global_styles_*
to theme_json_*
global_styles_*
to theme_json_*
global_styles_*
to theme_json_*
d1c5066
to
1ab90c0
Compare
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.
LGTM 👍
@@ -1,11 +1,11 @@ | |||
# Global Styles Filters | |||
|
|||
WordPress 6.1 has introduced some server-side filters to hook into the data provided to Global Styles & Settings: |
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 only updates the names of the filters. I'm undecided as to whether we should rename the "Global Styles Filters" page to "Theme.json Filters". Because it's published to the block editor handbook already, renaming it requires asking someone from the meta team to remove the old one. As it is also works fine if we want to add new filters later, so I lean towards maintaining what we have.
These changes are being backported as part of WordPress/wordpress-develop#3247 |
@c4rl0sbr4v0 Shall this be moved to milestone 14.1, so you can cherry-pick for the 14.1 release tomorrow? |
I just cherry-picked this PR to the wp/6.1 branch to get it included in the next release: 6d76c1b |
…6.1. This changeset ports the work done in Gutenberg (released in 14.1) to add hooks to filter the `theme.json` data. Specifically, it adds the following filters: `theme_json_default`, `theme_json_blocks`, `theme_json_theme`, and `theme_json_user`. For more details, see the following Gutenberg pull requests: - [WordPress/gutenberg#44015 gutenberg#44015]: Make global styles data filterable - [WordPress/gutenberg#44109 gutenberg#44109]: Prepare `WP_Theme_JSON_Data` class for backporting - [WordPress/gutenberg#44159 gutenberg#44159]: Update hook's names from `global_styles_*` to `theme_json_*` Props oandregal, czapla, gziolo, bernhard-reiter. See #56467. git-svn-id: https://develop.svn.wordpress.org/trunk@54251 602fd350-edb4-49c9-b593-d223f7449a82
…6.1. This changeset ports the work done in Gutenberg (released in 14.1) to add hooks to filter the `theme.json` data. Specifically, it adds the following filters: `theme_json_default`, `theme_json_blocks`, `theme_json_theme`, and `theme_json_user`. For more details, see the following Gutenberg pull requests: - [WordPress/gutenberg#44015 gutenberg#44015]: Make global styles data filterable - [WordPress/gutenberg#44109 gutenberg#44109]: Prepare `WP_Theme_JSON_Data` class for backporting - [WordPress/gutenberg#44159 gutenberg#44159]: Update hook's names from `global_styles_*` to `theme_json_*` Props oandregal, czapla, gziolo, bernhard-reiter. See #56467. Built from https://develop.svn.wordpress.org/trunk@54251 git-svn-id: http://core.svn.wordpress.org/trunk@53810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…6.1. This changeset ports the work done in Gutenberg (released in 14.1) to add hooks to filter the `theme.json` data. Specifically, it adds the following filters: `theme_json_default`, `theme_json_blocks`, `theme_json_theme`, and `theme_json_user`. For more details, see the following Gutenberg pull requests: - [WordPress/gutenberg#44015 gutenberg#44015]: Make global styles data filterable - [WordPress/gutenberg#44109 gutenberg#44109]: Prepare `WP_Theme_JSON_Data` class for backporting - [WordPress/gutenberg#44159 gutenberg#44159]: Update hook's names from `global_styles_*` to `theme_json_*` Props oandregal, czapla, gziolo, bernhard-reiter. See #56467. Built from https://develop.svn.wordpress.org/trunk@54251 git-svn-id: https://core.svn.wordpress.org/trunk@53810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
…6.1. This changeset ports the work done in Gutenberg (released in 14.1) to add hooks to filter the `theme.json` data. Specifically, it adds the following filters: `theme_json_default`, `theme_json_blocks`, `theme_json_theme`, and `theme_json_user`. For more details, see the following Gutenberg pull requests: - [WordPress/gutenberg#44015 gutenberg#44015]: Make global styles data filterable - [WordPress/gutenberg#44109 gutenberg#44109]: Prepare `WP_Theme_JSON_Data` class for backporting - [WordPress/gutenberg#44159 gutenberg#44159]: Update hook's names from `global_styles_*` to `theme_json_*` Props oandregal, czapla, gziolo, bernhard-reiter. See #56467. git-svn-id: https://develop.svn.wordpress.org/trunk@54251 602fd350-edb4-49c9-b593-d223f7449a82
What?
In #44015 we've added a few hooks to filter the theme.json data at the different layer levels. This PR proposes that we rename them:
global_styles_default
=>theme_json_default
global_styles_blocks
=>theme_json_blocks
global_styles_theme
=>theme_json_theme
global_styles_user
=>theme_json_user
Why?
Because we're not filtering "global styles" but a specific part of it: the
theme.json
data it takes as input. The new names make this clearer. We also leave theglobal_styles_
prefix free for the future, in case we want to offer other kind of filters.How?
Testing Instructions
Use the filters to modify some of the data. For example, this is how the theme data can be modified: