Definition:
function clean_post_cache($id) {}
Will clean the post in the cache.
Cleaning means delete from the cache of the post. Will call to clean the term object cache associated with the post ID.
Parameters
- int $id: The Post ID in the cache to clean
Defined actions
- clean_post_cache
do_action('clean_post_cache', $id);
Source code
function clean_post_cache($id) {
global $_wp_suspend_cache_invalidation, $wpdb;
if ( !empty($_wp_suspend_cache_invalidation) )
return;
$id = (int) $id;
if ( 0 === $id )
return;
wp_cache_delete($id, 'posts');
wp_cache_delete($id, 'post_meta');
clean_object_term_cache($id, 'post');
wp_cache_delete( 'wp_get_archives', 'general' );
do_action('clean_post_cache', $id);
if ( $children = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d", $id) ) ) {
foreach ( $children as $cid ) {
// Loop detection
if ( $cid == $id )
continue;
clean_post_cache( $cid );
}
}
if ( is_multisite() )
wp_cache_delete( $wpdb->blogid . '-' . $id, 'global-posts' );
}
627

February 11, 2011 


No comments yet... Be the first to leave a reply!