mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-08 17:38:26 +01:00
Themes: Improve performance of _add_block_template_part_area_info
and _add_block_template_info
functions.
Improve performance of `_add_block_template_part_area_info` and `_add_block_template_info` function by passing the `with_supports` parameter to the `WP_Theme_JSON_Resolver::get_theme_data` method. This results in hitting an existing cache and in many less calls to get_option. Props spacedmonkey, flixos90, SergeyBiryukov, peterwilsoncc, desrosj. Fixes #57077. Built from https://develop.svn.wordpress.org/trunk@54998 git-svn-id: http://core.svn.wordpress.org/trunk@54531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
645e753a51
commit
72948dee1e
@ -351,7 +351,7 @@ function _add_block_template_info( $template_item ) {
|
|||||||
return $template_item;
|
return $template_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
$theme_data = WP_Theme_JSON_Resolver::get_theme_data()->get_custom_templates();
|
$theme_data = WP_Theme_JSON_Resolver::get_theme_data( array(), array( 'with_supports' => false ) )->get_custom_templates();
|
||||||
if ( isset( $theme_data[ $template_item['slug'] ] ) ) {
|
if ( isset( $theme_data[ $template_item['slug'] ] ) ) {
|
||||||
$template_item['title'] = $theme_data[ $template_item['slug'] ]['title'];
|
$template_item['title'] = $theme_data[ $template_item['slug'] ]['title'];
|
||||||
$template_item['postTypes'] = $theme_data[ $template_item['slug'] ]['postTypes'];
|
$template_item['postTypes'] = $theme_data[ $template_item['slug'] ]['postTypes'];
|
||||||
@ -371,7 +371,7 @@ function _add_block_template_info( $template_item ) {
|
|||||||
*/
|
*/
|
||||||
function _add_block_template_part_area_info( $template_info ) {
|
function _add_block_template_part_area_info( $template_info ) {
|
||||||
if ( WP_Theme_JSON_Resolver::theme_has_support() ) {
|
if ( WP_Theme_JSON_Resolver::theme_has_support() ) {
|
||||||
$theme_data = WP_Theme_JSON_Resolver::get_theme_data()->get_template_parts();
|
$theme_data = WP_Theme_JSON_Resolver::get_theme_data( array(), array( 'with_supports' => false ) )->get_template_parts();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $theme_data[ $template_info['slug'] ]['area'] ) ) {
|
if ( isset( $theme_data[ $template_info['slug'] ]['area'] ) ) {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.2-alpha-54997';
|
$wp_version = '6.2-alpha-54998';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user