Make WordPress Core


Ignore:
Timestamp:
03/31/2022 10:04:25 AM (4 years ago)
Author:
spacedmonkey
Message:

Taxonomy: Improve performance by taxonomy queries by adding a limitting requested terms.

Add a limit to the number of terms requested in taxonomy queries. This improves the performance of the query and the likelihood of hitting an existing term query cache.

Props Spacedmonkey, peterwilsoncc, flixos90.
Fixes #55360.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-tax-query.php

    r52455 r53037  
    638638        }
    639639
     640        if ( ! is_taxonomy_hierarchical( $query['taxonomy'] ) ) {
     641            $args['number'] = count( $terms );
     642        }
     643
    640644        $term_query = new WP_Term_Query();
    641645        $term_list  = $term_query->query( $args );
Note: See TracChangeset for help on using the changeset viewer.