Make WordPress Core


Ignore:
Timestamp:
05/17/2023 09:21:09 AM (14 months ago)
Author:
spacedmonkey
Message:

Editor: Disable lazy loading term meta in get_block_templates.

Pass false to the lazy_load_term_meta parameter given to the WP_Query found in get_block_templates. Template post types only ever have one term assigned to them. So priming term meta, does not help performance as lazy loading term meta is only useful if loading multiple terms. As get_block_templates is run multiple times on a block theme request, this saves processing time.

Props spacedmonkey, andraganescu, ntsekouras, oandregal, westonruter.
Fixes #58230.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-template-utils.php

    r55744 r55817  
    953953    $post_type     = isset( $query['post_type'] ) ? $query['post_type'] : '';
    954954    $wp_query_args = array(
    955         'post_status'    => array( 'auto-draft', 'draft', 'publish' ),
    956         'post_type'      => $template_type,
    957         'posts_per_page' => -1,
    958         'no_found_rows'  => true,
    959         'tax_query'      => array(
     955        'post_status'         => array( 'auto-draft', 'draft', 'publish' ),
     956        'post_type'           => $template_type,
     957        'posts_per_page'      => -1,
     958        'no_found_rows'       => true,
     959        'lazy_load_term_meta' => false,
     960        'tax_query'           => array(
    960961            array(
    961962                'taxonomy' => 'wp_theme',
Note: See TracChangeset for help on using the changeset viewer.