Correct an SQL syntax error introduced in r30158. Adds tests.

Fixes #30339
See #18962
Props julien731


git-svn-id: https://develop.svn.wordpress.org/trunk@30480 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2014-11-20 16:45:48 +00:00
parent 4dd55dcced
commit 8fe059d426
2 changed files with 62 additions and 1 deletions

View File

@@ -3720,7 +3720,7 @@ function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_p
$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_ID, $post_parent ) );
$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID, $post_parent ) );
$suffix++;
} while ( $post_name_check );
$slug = $alt_post_name;