Make WordPress Core


Ignore:
Timestamp:
01/04/2008 07:55:17 PM (17 years ago)
Author:
ryan
Message:

Page walk fixes from hailin. fixes #5581

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.