#56796 closed defect (bug) (fixed)
Naming of filters in `class-wp-theme-json-resolver.php` (`theme_json_*`)
Reported by: | kebbet | Owned by: | hellofromTonya |
---|---|---|---|
Milestone: | 6.1 | Priority: | normal |
Severity: | normal | Version: | 6.1 |
Component: | Editor | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
With 6.1 we are introducing filters for theme.json, all named theme_json_*
which results in filters like:
theme_json_default
theme_json_theme
theme_json_blocks
theme_json_user
theme_json_theme
Are we ok with this?
To me, the naming is a bit odd, espcially theme_json_theme
. Could better names for the filter be used?
Change History (15)
#2
@
2 years ago
- Keywords needs-patch added
- Milestone changed from 6.1 to Awaiting Review
+1 We are using wp_
prefix for the new filters.
#4
@
2 years ago
Plus theme_json_get_style_nodes
in wp-includes/class-wp-theme-json.php
and wp-includes/script-loader.php
which is about to be introduced in 6.1 aswell.
This ticket was mentioned in Slack in #core by desrosj. View the logs.
2 years ago
This ticket was mentioned in PR #3443 on WordPress/wordpress-develop by kebbet.
2 years ago
#6
- Keywords has-patch added; needs-patch removed
Adding _data
to filter names.
https://core.trac.wordpress.org/ticket/56796
#7
@
2 years ago
- Keywords needs-patch added; has-patch removed
The linked PR leaves out theme_json_get_style_nodes
from any changes.
SergeyBiryukov commented on PR #3443:
2 years ago
#9
Should we consider putting data
in the middle, e.g. theme_json_data_default
, etc. to closer match WP_Theme_JSON_Data
?
Not sure about adding the wp_
prefix, but seems to make sense here too? theme_json_get_style_nodes
would then also need the prefix.
hellofromtonya commented on PR #3443:
2 years ago
#10
Test failures are unrelated to this PR and are currently present in trunk
.
#11
@
2 years ago
- Keywords commit added
- Owner set to hellofromTonya
- Status changed from new to reviewing
There's consensus to use the wp_theme_json_data_{$context}
naming structure. PR 3443 has been approved by 2 committers. It's ready for commit.
hellofromtonya commented on PR #3443:
2 years ago
#13
Committed via changeset https://core.trac.wordpress.org/changeset/54501. Thank you everyone for your contributions 🎉
@oandregal commented on PR #3443:
2 years ago
#14
This PR needs a few follow-ups:
- x [The devnote for 6.1] (it had already been published when this PR was proposed). I've gone ahead and update it.
- [ ] The documentation for this in the handbook.
- [ ] The same code in Gutenberg.
I've prepared https://github.com/WordPress/gutenberg/pull/44940 to address the last two items. Would anyone be available for review?
Thanks @kebbet! Moving to 6.1 for consideration. I agree, it seems a bit odd. But also not sure of a better suggestion.