WordPress.org

Make WordPress Core

Ticket #6538: post-name-check-fix.diff

File post-name-check-fix.diff, 801 bytes (added by Nao, 14 years ago)

Fix for duplicate title post error

  • wp-admin/includes/post.php

     
    12701270                        $suffix = 2;
    12711271                        do {
    12721272                                $alt_post_name = substr($post_name, 0, 200-(strlen($suffix)+1)). "-$suffix";
     1273                                $alt_post_name = urldecode($alt_post_name);
    12731274                                // expected_slashed ($alt_post_name, $post_name, $post_type)
    12741275                                $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));
    12751276                                $suffix++;
    12761277                        } while ($post_name_check);
    1277                         $post_name = $alt_post_name;
     1278                        $post_name =urlencode($alt_post_name);
    12781279                }
    12791280        }
    12801281