Syncronise the queries used for attachment slug uniqueness checking. Fixes #4396 props futurix and Nazgul.

git-svn-id: http://svn.automattic.com/wordpress/trunk@10693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2009-03-04 08:03:02 +00:00
parent add8403cec
commit 303d892aa8
1 changed files with 1 additions and 1 deletions

View File

@ -2381,7 +2381,7 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
while ($post_name_check) {
$alt_post_name = $post_name . "-$suffix";
// expected_slashed ($alt_post_name, $post_name)
$post_name_check = $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_status = 'inherit' AND ID != %d AND post_parent = %d LIMIT 1", $alt_post_name, $post_ID, $post_parent));
$post_name_check = $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_status = 'inherit' AND ID != %d LIMIT 1", $alt_post_name, $post_ID, $post_parent));
$suffix++;
}
$post_name = $alt_post_name;