From cbad06c47ede0a8408f5c45b65e2b87599130776 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 23 Oct 2007 16:43:15 +0000 Subject: [PATCH] Remove unnecessary GROUP BY when getting max term_group. Props michelwp. fixes #5240 git-svn-id: https://develop.svn.wordpress.org/trunk@6285 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/taxonomy.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 882b7c1e5b..1f86b1f73c 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1045,7 +1045,7 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) { $term_group = $alias->term_group; } else { // The alias isn't in a group, so let's create a new one and firstly add the alias term to it. - $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms GROUP BY term_group") + 1; + $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1; $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->terms SET term_group = %d WHERE term_id = %d", $term_group, $alias->term_id ) ); } } @@ -1255,7 +1255,7 @@ function wp_update_term( $term, $taxonomy, $args = array() ) { $term_group = $alias->term_group; } else { // The alias isn't in a group, so let's create a new one and firstly add the alias term to it. - $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms GROUP BY term_group") + 1; + $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1; $wpdb->update( $wpdb->terms, compact('term_group'), array( 'term_id' => $alias->term_id ) ); } }