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

git-svn-id: https://develop.svn.wordpress.org/trunk@4199 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-09-21 00:01:20 +00:00
parent 3c348108f8
commit 3472772716
1 changed files with 3 additions and 3 deletions

View File

@ -591,13 +591,13 @@ function wp_insert_post($postarr = array()) {
if ( 'draft' != $post_status ) {
$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");
if ($post_name_check) {
if ($post_name_check || in_array($post_name, $wp_rewrite->feeds) ) {
$suffix = 2;
while ($post_name_check) {
do {
$alt_post_name = $post_name . "-$suffix";
$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");
$suffix++;
}
} while ($post_name_check);
$post_name = $alt_post_name;
}
}