mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
Don't force distinct term queries when specifying number and object_ids.
This reverts [41377], which caused performance problems on sites with a large number of terms. See #41796. git-svn-id: https://develop.svn.wordpress.org/trunk@41880 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -553,16 +553,6 @@ class WP_Term_Query {
|
||||
$limits = '';
|
||||
}
|
||||
|
||||
$do_distinct = false;
|
||||
|
||||
/*
|
||||
* Duplicate terms are generally removed when necessary after the database query.
|
||||
* But when a LIMIT clause is included in the query, we let MySQL enforce
|
||||
* distinctness so the count is correct.
|
||||
*/
|
||||
if ( ! empty( $limits ) && 'all_with_object_id' !== $args['fields'] ) {
|
||||
$do_distinct = true;
|
||||
}
|
||||
|
||||
if ( ! empty( $args['search'] ) ) {
|
||||
$this->sql_clauses['where']['search'] = $this->get_search_sql( $args['search'] );
|
||||
@@ -580,7 +570,8 @@ class WP_Term_Query {
|
||||
if ( ! empty( $meta_clauses ) ) {
|
||||
$join .= $mq_sql['join'];
|
||||
$this->sql_clauses['where']['meta_query'] = preg_replace( '/^\s*AND\s*/', '', $mq_sql['where'] );
|
||||
$do_distinct = true;
|
||||
$distinct .= "DISTINCT";
|
||||
|
||||
}
|
||||
|
||||
$selects = array();
|
||||
@@ -642,8 +633,6 @@ class WP_Term_Query {
|
||||
|
||||
$where = implode( ' AND ', $this->sql_clauses['where'] );
|
||||
|
||||
$distinct = $do_distinct ? 'DISTINCT' : '';
|
||||
|
||||
/**
|
||||
* Filters the terms query SQL clauses.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user