diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 32f28b1ca0..5b7ff0f7ca 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -615,10 +615,17 @@ function page_template_dropdown($default = '') { } function parent_dropdown($default = 0, $parent = 0, $level = 0) { - global $wpdb; + global $wpdb, $post_ID; $items = $wpdb->get_results("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_status = 'static' ORDER BY menu_order"); + if ($items) { foreach ($items as $item) { + // A page cannot be it's own parent. + if (!empty($post_ID)) { + if ($item->ID == $post_ID) { + continue; + } + } $pad = str_repeat(' ', $level * 3); if ($item->ID == $default) $current = ' selected="selected"'; diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php index f3b8ed4771..a29ee7c234 100644 --- a/wp-admin/edit-page-form.php +++ b/wp-admin/edit-page-form.php @@ -34,7 +34,7 @@ window.onload = focusit;