Use parse_request instead of wp_loaded action for scraping duotone data from theme.json#49343
Use parse_request instead of wp_loaded action for scraping duotone data from theme.json#49343jeryj wants to merge 1 commit into
parse_request instead of wp_loaded action for scraping duotone data from theme.json#49343Conversation
…ta from theme.json Scraping on wp_loaded caused theme.json to be cached too early which prevents editor-only selectors from being used in theme.json. Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com>
|
Pairing with @ajlende and there's an issue with the selectors API from #46496 that is causing this issue when there are definitions in packages/block-library/src/image/block.json that are removing the duotone support unintentionally. Removing these lines from "selectors": {
"border": ".wp-block-image img"
},
"editorSelectors": {
"border": ".wp-block-image img, .wp-block-image .wp-block-image__crop-area"
}, |
Thanks for flagging @jeryj 👍 The Selectors API got merged prematurely before I could get a final code review on it. I spotted this issue as well last week and put up a PR to update Duotone support to use the selectors API in #49325. I think the better approach is to fix the issue rather than revert to a soon-to-be obsolete, experimental property. |
|
I think this has now been fixed, so I think we can close this? |
Has it actually been fixed or more that we've temporarily removed editor-only selectors? We can of course re-open as necessary but trying to keep the caching of block metadata in theme.json as late as possible sounds less likely to trip up future enhancements to theme.json processing. |
Fixes #49324
What?
#49103 scrapes duotone theme.json data on
wp_loaded, which causes theme.json to be cached too early and prevents editor-only selectors from being used in theme.json.Why?
Not being able to generate editor-only selectors via theme.json causes a regression with the Image block and the border not being applied to the inline cropping area.
How?
Use
parse_requestinstead ofwp_loadedaction to delay scraping duotone data from theme.json until after the editor-only selectors processes have finished.Testing Instructions
trunkfix/duotone-action-order