From 2d59d18e3a14df8d96ed240b7af3bd7546f1a3c0 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Tue, 15 Sep 2015 20:52:40 +0000 Subject: [PATCH] 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 --- src/wp-includes/taxonomy-functions.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/taxonomy-functions.php b/src/wp-includes/taxonomy-functions.php index 65f9772275..8a80184197 100644 --- a/src/wp-includes/taxonomy-functions.php +++ b/src/wp-includes/taxonomy-functions.php @@ -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 )