Make WordPress Core

Ticket #1231: do-not-feed-the-post-title.diff

File do-not-feed-the-post-title.diff, 937 bytes (added by skeltoac, 20 years ago)
  • wp-includes/post.php

     
    591591        if ( 'draft' != $post_status ) {
    592592                $post_name_check = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$post_name' AND post_type = '$post_type' AND ID != '$post_ID' AND post_parent = '$post_parent' LIMIT 1");
    593593
    594                 if ($post_name_check) {
     594                if ($post_name_check || in_array($post_name, $wp_rewrite->feeds) ) {
    595595                        $suffix = 2;
    596                         while ($post_name_check) {
     596                        do {
    597597                                $alt_post_name = $post_name . "-$suffix";
    598598                                $post_name_check = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_type = '$post_type' AND ID != '$post_ID' AND post_parent = '$post_parent' LIMIT 1");
    599599                                $suffix++;
    600                         }
     600                        } while ($post_name_check);
    601601                        $post_name = $alt_post_name;
    602602                }
    603603        }