Changeset 6552

Show
Ignore:
Timestamp:
01/04/08 19:55:17 (9 months ago)
Author:
ryan
Message:

Page walk fixes from hailin. fixes #5581

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/includes/template.php

    r6551 r6552  
    284284 
    285285    foreach ( $pages as $page ) { 
     286         
     287        // catch and repair bad pages  
     288        if ( $page->post_parent == $page->ID ) { 
     289            $page->post_parent = 0;  
     290            $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) ); 
     291            clean_page_cache( $page->ID ); 
     292        } 
     293          
    286294        if ( 0 == $page->post_parent ) 
    287295            $top_level_pages[] = $page;  
  • trunk/wp-includes/classes.php

    r6551 r6552  
    435435                array_splice( $children_elements, $i, 1 ); 
    436436                $output = $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output ); 
    437                 $i--;  
     437                $i = -1;  
    438438            } 
    439439        }