From 4be3f7547ba86ae1de3c2d5376b4e2ed99e62020 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 21 Sep 2006 00:01:20 +0000 Subject: [PATCH] Don't allow pages to have the same names as feeds to avoid rewrite collision. Props skeltoac. fixes #1231 git-svn-id: http://svn.automattic.com/wordpress/trunk@4199 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 468ed3737..1968714b5 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -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; } }