Page walk fixes from hailin. fixes #5581
git-svn-id: http://svn.automattic.com/wordpress/trunk@6552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1ae1811dd0
commit
91586ebff4
|
@ -283,6 +283,14 @@ function page_rows( $pages ) {
|
|||
$children_pages = array();
|
||||
|
||||
foreach ( $pages as $page ) {
|
||||
|
||||
// catch and repair bad pages
|
||||
if ( $page->post_parent == $page->ID ) {
|
||||
$page->post_parent = 0;
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
|
||||
clean_page_cache( $page->ID );
|
||||
}
|
||||
|
||||
if ( 0 == $page->post_parent )
|
||||
$top_level_pages[] = $page;
|
||||
else
|
||||
|
|
|
@ -434,7 +434,7 @@ class Walker {
|
|||
|
||||
array_splice( $children_elements, $i, 1 );
|
||||
$output = $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
|
||||
$i--;
|
||||
$i = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue