-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Add registered_block_type action, register clearing Theme JSON cache to fix global styles issue #3392
Add registered_block_type action, register clearing Theme JSON cache to fix global styles issue #3392
Changes from all commits
02e2600
2e1c4a8
2002af5
953f969
76fdfe7
5782aa3
a7b7021
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,6 +147,18 @@ function wp_clean_themes_cache( $clear_update_cache = true ) { | |
} | ||
} | ||
|
||
/** | ||
* Clears the cache held by WP_Theme_JSON and WP_Theme_JSON_Resolver classes. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be worth adding more documentation if this is a public function. I'm thinking along the lines of a brief detailing of the side effects calling this function will have. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I've added an extra line here to indicate what the function does. I found it hard to capture in a single sentence without falling into the trap of describing the particular use case with |
||
* | ||
* Ensures that subsequent calls to either class generate fresh core, theme, user, and block data. | ||
* | ||
* @since 6.1.0 | ||
*/ | ||
function wp_clean_theme_json_cache() { | ||
WP_Theme_JSON::clean_cached_data(); | ||
WP_Theme_JSON_Resolver::clean_cached_data(); | ||
} | ||
|
||
/** | ||
* Whether a child theme is in use. | ||
* | ||
|
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.
I'm not completely sure of what the best naming convention is, but I see some actions use past tense and others use something like 'after_register_block_type' or 'post_register_block_type'.
It would be interesting to know if there's a preference!
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.
Same, I'd be curious to hear what folks think! In this case, I borrowed the naming convention from
registered_post_type
andregistered_taxonomy
.