From 73b0feb5b807ca128d0956acba7c24f0b622f622 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sun, 13 Mar 2005 01:24:18 +0000 Subject: [PATCH] Don't allow a page to be its own parent. http://mosquito.wordpress.org/view.php?id=1095 git-svn-id: https://develop.svn.wordpress.org/trunk@2435 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/template-functions-post.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wp-includes/template-functions-post.php b/wp-includes/template-functions-post.php index 6245440856..ed13d4820a 100644 --- a/wp-includes/template-functions-post.php +++ b/wp-includes/template-functions-post.php @@ -348,7 +348,8 @@ function wp_list_pages($args = '') { // array index we set the curent page as a child of that page. // We can now start looping over the $page_tree array // with any ID which will output the page links from that ID downwards. - $page_tree[$page->post_parent]['children'][] = $page->ID; + if ( $page->post_parent != $page->ID) + $page_tree[$page->post_parent]['children'][] = $page->ID; } // Output of the pages starting with child_of as the root ID. // child_of defaults to 0 if not supplied in the query.