Update hook's names from global_styles_* to theme_json_*#44159
Merged
Update hook's names from global_styles_* to theme_json_*#44159
global_styles_* to theme_json_*#44159Conversation
global_styles_* to theme_json_*
global_styles_* to theme_json_*global_styles_* to theme_json_*
d1c5066 to
1ab90c0
Compare
oandregal
commented
Sep 14, 2022
| @@ -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: | |||
Member
Author
There was a problem hiding this comment.
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.
Member
Author
|
These changes are being backported as part of WordPress/wordpress-develop#3247 |
37 tasks
Contributor
|
@c4rl0sbr4v0 Shall this be moved to milestone 14.1, so you can cherry-pick for the 14.1 release tomorrow? |
cbravobernal
pushed a commit
that referenced
this pull request
Sep 15, 2022
Contributor
Contributor
|
I just cherry-picked this PR to the wp/6.1 branch to get it included in the next release: 6d76c1b |
pento
pushed a commit
to WordPress/wordpress-develop
that referenced
this pull request
Sep 20, 2022
…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
markjaquith
pushed a commit
to markjaquith/WordPress
that referenced
this pull request
Sep 20, 2022
…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
github-actions bot
pushed a commit
to platformsh/wordpress-performance
that referenced
this pull request
Sep 20, 2022
…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
ootwch
pushed a commit
to ootwch/wordpress-develop
that referenced
this pull request
Nov 4, 2022
…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
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.
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_defaultglobal_styles_blocks=>theme_json_blocksglobal_styles_theme=>theme_json_themeglobal_styles_user=>theme_json_userWhy?
Because we're not filtering "global styles" but a specific part of it: the
theme.jsondata 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: