Page walk fixes from hailin. fixes #5581
git-svn-id: https://develop.svn.wordpress.org/trunk@6552 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
791a7d7191
commit
153ce1be0d
@ -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
Block a user