From 024de1d4c630760b13c1b9cb51134cad6039ed50 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 2 May 2008 17:28:36 +0000 Subject: [PATCH] Fix post name check prepare. Props westi. see #6894 for 2.5 git-svn-id: https://develop.svn.wordpress.org/branches/2.5@7877 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index cca4149a52..77ea9648fa 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1285,8 +1285,7 @@ function wp_insert_post($postarr = array()) { $suffix = 2; do { $alt_post_name = substr($post_name, 0, 200-(strlen($suffix)+1)). "-$suffix"; - // expected_slashed ($alt_post_name, $post_name, $post_type) - $post_name_check = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_type = '$post_type' AND ID != %d AND post_parent = %d LIMIT 1", $post_ID, $post_parent)); + $post_name_check = $wpdb->get_var($wpdb->prepare("SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d AND post_parent = %d LIMIT 1", $alt_post_name, $post_type, $post_ID, $post_parent)); $suffix++; } while ($post_name_check); $post_name = $alt_post_name;