From e1ae860b7d2fad7dc98aa66d0319534ccf93e0a5 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Sat, 5 Apr 2008 05:54:08 +0000 Subject: [PATCH] The child should not have to pay for the sins of his father. Caching for children needs to be cleared when parent is edited; if we check for empty and not isset, it never gets better for empty results. git-svn-id: https://develop.svn.wordpress.org/trunk@7601 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 590e128ab9..628ea10f1f 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2712,12 +2712,19 @@ function update_page_cache(&$pages) { * @param int $id Page ID to clean */ function clean_page_cache($id) { + global $wpdb; + $id = (int) $id; + clean_post_cache($id); wp_cache_delete( 'all_page_ids', 'posts' ); wp_cache_delete( 'get_pages', 'posts' ); do_action('clean_page_cache', $id); + + if ( $children = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_parent = '$id'" ) ) + foreach( $children as $cid ) + clean_post_cache( $cid ); } /** @@ -2943,7 +2950,7 @@ function _save_post_hook($post_id, $post) { function _get_post_ancestors(&$_post) { global $wpdb; - if ( !empty($_post->ancestors) ) + if ( !isset($_post->ancestors) ) return; $_post->ancestors = array();