Omit the `ORDER BY` clause when updating object term cache.

The `ORDER BY` clause was forcing filesorts on large tables, and is
unnecessary, since term order doesn't matter when updating the cache.

Props mbrandys, wonderboymusic.
Fixes #28922.

git-svn-id: https://develop.svn.wordpress.org/trunk@34217 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2015-09-15 20:52:40 +00:00
parent e05586646a
commit 2d59d18e3a
1 changed files with 4 additions and 1 deletions

View File

@ -3274,7 +3274,10 @@ function update_object_term_cache($object_ids, $object_type) {
if ( empty( $ids ) )
return false;
$terms = wp_get_object_terms($ids, $taxonomies, array('fields' => 'all_with_object_id'));
$terms = wp_get_object_terms( $ids, $taxonomies, array(
'fields' => 'all_with_object_id',
'orderby' => 'none',
) );
$object_terms = array();
foreach ( (array) $terms as $term )