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. Built from https://develop.svn.wordpress.org/trunk@53037 git-svn-id: http://core.svn.wordpress.org/trunk@52626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1ad5807bb0
commit
afcc5e64f4
|
@ -637,6 +637,10 @@ class WP_Tax_Query {
|
|||
break;
|
||||
}
|
||||
|
||||
if ( ! is_taxonomy_hierarchical( $query['taxonomy'] ) ) {
|
||||
$args['number'] = count( $terms );
|
||||
}
|
||||
|
||||
$term_query = new WP_Term_Query();
|
||||
$term_list = $term_query->query( $args );
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-alpha-53036';
|
||||
$wp_version = '6.0-alpha-53037';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue