#62234 closed enhancement (fixed)
Theme JSON: remove redundant check and relocate $selectors assignment in get_block_nodes()
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | has-patch, gutenberg-merge |
Focuses: | Cc: |
Description
A ticket to track the backport of Gutenberg PR: https://github.com/WordPress/gutenberg/pull/66154
In WP_Theme_JSON::get_block_nodes()
, remove the redundant check for $theme_json['styles']
, which means WP_Theme_JSON::get_blocks_metadata()
is only called if necessary.
This also has the potential to slightly improve the performance of functions such as [wp_add_global_styles_for_blocks](https://github.com/wordpress/wordpress-develop/blob/trunk/src/wp-includes/global-styles-and-settings.php#L254) that call WP_Theme_JSON::get_styles_block_nodes()
, where no block styles exist.
Change History (9)
This ticket was mentioned in PR #7575 on WordPress/wordpress-develop by @ramonopoly.
9 months ago
#1
@mukesh27 commented on PR #7575:
9 months ago
#2
@ramonjd Good if we commit for 6.7. WDYT?
@ramonopoly commented on PR #7575:
9 months ago
#3
Good if we commit for 6.7. WDYT?
Thank you, yes!
@ramonopoly commented on PR #7575:
9 months ago
#4
Updated with code suggestion. Ready for final ✔️
@mukesh27 commented on PR #7575:
9 months ago
#5
@ramonjd Move into 6.7 and commit when you have moment.
#7
@
9 months ago
- Owner set to ramonopoly
- Resolution set to fixed
- Status changed from new to closed
In 59262:
@ramonopoly commented on PR #7575:
9 months ago
#8
Committed in r59262 / 1508e5bf0fa3ad2d001de08eab4dee49985bb322
Backporting:
## What? Why? How?
In
WP_Theme_JSON::get_block_nodes()
, Remove redundant check for$theme_json['styles']
, which meansWP_Theme_JSON::get_blocks_metadata()
is only called if necessary.This also has the potential to slightly improve the performance of functions such as wp_add_global_styles_for_blocks that call
WP_Theme_JSON::get_styles_block_nodes()
, where no block styles exist.## Testing Instructions
CI tests should pass.
Smoke test in a block theme with lots of block styles, like TT4 and a theme with none, like Emptytheme