Ticket #9726: 9726.diff
| File 9726.diff, 1.4 KB (added by , 17 years ago) |
|---|
-
wp-includes/post.php
1717 1717 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d AND post_parent = %d LIMIT 1"; 1718 1718 $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_type, $post_ID, $post_parent)); 1719 1719 } 1720 1720 1721 1721 if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) { 1722 1722 $suffix = 2; 1723 1723 do { … … 2415 2415 else 2416 2416 $post_name = sanitize_title($post_name); 2417 2417 2418 // expected_slashed ($post_name) 2419 $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", $post_name, $post_ID)); 2418 $post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent); 2420 2419 2421 if ($post_name_check) {2422 $suffix = 2;2423 while ($post_name_check) {2424 $alt_post_name = $post_name . "-$suffix";2425 // expected_slashed ($alt_post_name, $post_name)2426 $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));2427 $suffix++;2428 }2429 $post_name = $alt_post_name;2430 }2431 2432 2420 if ( empty($post_date) ) 2433 2421 $post_date = current_time('mysql'); 2434 2422 if ( empty($post_date_gmt) )