WordPress.org

Make WordPress Core

Ticket #3033: post.php.diff

File post.php.diff, 893 bytes (added by filosofo, 9 years ago)
  • wp-includes/post.php

     
    11861186        else 
    11871187                $post_name = sanitize_title($post_name); 
    11881188 
     1189        $post_name_check = 
     1190                $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$post_name' AND post_status = 'inherit' AND ID != '$post_ID' LIMIT 1"); 
     1191 
     1192        if ($post_name_check) { 
     1193                $suffix = 2; 
     1194                while ($post_name_check) { 
     1195                        $alt_post_name = $post_name . "-$suffix"; 
     1196                        $post_name_check = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_status = 'inherit' AND ID != '$post_ID' AND post_parent = '$post_parent' LIMIT 1"); 
     1197                        $suffix++; 
     1198                } 
     1199                $post_name = $alt_post_name; 
     1200        } 
     1201 
    11891202        if (empty($post_date)) 
    11901203                $post_date = current_time('mysql'); 
    11911204        if (empty($post_date_gmt))