Make WordPress Core


Ignore:
Timestamp:
01/26/2023 06:37:47 PM (2 years ago)
Author:
flixos90
Message:

Themes: Avoid unnecessary database queries from get_default_block_editor_settings() in WP_Theme_JSON_Resolver::get_theme_data().

The get_default_block_editor_settings() function included several pieces of data that are irrelevant for the purpose that WP_Theme_JSON_Resolver was calling it for, yet resulted in three database queries on page load that can be avoided.

This changeset introduces a new function get_classic_theme_supports_block_editor_settings() to takes responsibility of only the data needed in WP_Theme_JSON_Resolver, which now uses that function. This leads to a reduction of database queries and accordingly a performance improvement.

Props mamaduka, spacedmonkey, oandregal, flixos90, audrasjb, mukesh27.
Fixes #57547.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json-resolver.php

    r55128 r55146  
    287287         * and merge the static::$theme upon that.
    288288         */
    289         $theme_support_data = WP_Theme_JSON::get_from_editor_settings( get_default_block_editor_settings() );
     289        $theme_support_data = WP_Theme_JSON::get_from_editor_settings( get_classic_theme_supports_block_editor_settings() );
    290290        if ( ! wp_theme_has_theme_json() ) {
    291291            if ( ! isset( $theme_support_data['settings']['color'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.