Make WordPress Core


Ignore:
Timestamp:
12/14/2007 08:56:55 PM (18 years ago)
Author:
ryan
Message:

clean page cache when reparenting pages after deletion. Props hailin. fixes #5457

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r6379 r6382  
    759759        }
    760760
    761         // Point children of this page to its parent
     761        // Point children of this page to its parent, also clean the cache of affected children
     762        $children_query = $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE post_parent = %d AND post_type='page'", $postid);
     763        $children = $wpdb->get_results($children_query);
     764
    762765        $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'page' ) );
    763766    }
     
    774777    if ( 'page' == $post->post_type ) {
    775778        clean_page_cache($postid);
     779
     780        foreach ( (array) $children as $child )
     781            clean_page_cache($child->ID);
     782
    776783        $wp_rewrite->flush_rules();
    777784    } else {
Note: See TracChangeset for help on using the changeset viewer.