Index: wp-includes/post.php =================================================================== --- wp-includes/post.php (revision 35737) +++ wp-includes/post.php (working copy) @@ -3610,8 +3610,8 @@ } } else { // Post slugs must be unique across all posts. - $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1"; - $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) ); + $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d AND post_status = %s LIMIT 1"; + $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID, 'publish' ) ); // Prevent new post slugs that could result in URLs that conflict with date archives. $post = get_post( $post_ID ); @@ -3648,7 +3648,7 @@ $suffix = 2; do { $alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; - $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) ); + $post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID, 'publish' ) ); $suffix++; } while ( $post_name_check ); $slug = $alt_post_name;