From 0628a91cfc89147459987a40d958d1bf42f4846e Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 12 Apr 2017 11:38:59 +0100 Subject: [PATCH] Apply distinct to term id only --- includes/wc-term-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-term-functions.php b/includes/wc-term-functions.php index fd1d81b7501..6542ac681f5 100644 --- a/includes/wc-term-functions.php +++ b/includes/wc-term-functions.php @@ -507,7 +507,7 @@ function wc_terms_clauses( $clauses, $taxonomies, $args ) { } // Query fields. - $clauses['fields'] = 'DISTINCT ' . $clauses['fields'] . ', tm.meta_value'; + $clauses['fields'] = 'DISTINCT t.term_id, tm.meta_value, ' . $clauses['fields']; // Query join. if ( get_option( 'db_version' ) < 34370 ) {