Make WordPress Core

Changeset 4199


Ignore:
Timestamp:
09/21/2006 12:01:20 AM (19 years ago)
Author:
ryan
Message:

Don't allow pages to have the same names as feeds to avoid rewrite collision. Props skeltoac. fixes #1231

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r4198 r4199  
    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        }
Note: See TracChangeset for help on using the changeset viewer.