mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-23 06:55:28 +00:00
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: http://svn.automattic.com/wordpress/trunk@7601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
70dae93a6a
commit
ad1c6ea083
@ -2712,12 +2712,19 @@ function update_page_cache(&$pages) {
|
|||||||
* @param int $id Page ID to clean
|
* @param int $id Page ID to clean
|
||||||
*/
|
*/
|
||||||
function clean_page_cache($id) {
|
function clean_page_cache($id) {
|
||||||
|
global $wpdb;
|
||||||
|
$id = (int) $id;
|
||||||
|
|
||||||
clean_post_cache($id);
|
clean_post_cache($id);
|
||||||
|
|
||||||
wp_cache_delete( 'all_page_ids', 'posts' );
|
wp_cache_delete( 'all_page_ids', 'posts' );
|
||||||
wp_cache_delete( 'get_pages', 'posts' );
|
wp_cache_delete( 'get_pages', 'posts' );
|
||||||
|
|
||||||
do_action('clean_page_cache', $id);
|
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) {
|
function _get_post_ancestors(&$_post) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
if ( !empty($_post->ancestors) )
|
if ( !isset($_post->ancestors) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$_post->ancestors = array();
|
$_post->ancestors = array();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user