Check term_id against the $term object, not the non-existent var $args. Props rboren. Fixes #12729.

Built from https://develop.svn.wordpress.org/trunk@25106


git-svn-id: http://core.svn.wordpress.org/trunk@25088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2013-08-23 21:05:09 +00:00
parent 688ecb9fcc
commit 22c59d9c45

View File

@ -2380,8 +2380,8 @@ function wp_unique_term_slug($slug, $term) {
}
// If we didn't get a unique slug, try appending a number to make it unique.
if ( !empty($args['term_id']) )
$query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s AND term_id != %d", $slug, $args['term_id'] );
if ( ! empty( $term->term_id ) )
$query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s AND term_id != %d", $slug, $term->term_id );
else
$query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $slug );