[wp-trac] [WordPress Trac] #62234: Theme JSON: remove redundant check and relocate $selectors assignment in get_block_nodes()

WordPress Trac noreply at wordpress.org
Wed Oct 16 05:27:09 UTC 2024


#62234: Theme JSON: remove redundant check and relocate $selectors assignment in
get_block_nodes()
-------------------------+---------------------------------------
 Reporter:  ramonopoly   |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  6.8
Component:  Themes       |    Version:
 Severity:  normal       |   Keywords:  has-patch gutenberg-merge
  Focuses:               |
-------------------------+---------------------------------------
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62234>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list