clean_post_cache [ WordPress Function ]
| Parameters: |
|
| Uses: | |
| Defined at: |
|
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.
clean_post_cache() will call itself recursively for each child post.
This function not run if $_wp_suspend_cache_invalidation is not empty. See wp_suspend_cache_invalidation().
Source
<?php
function clean_post_cache( $post ) {
global $_wp_suspend_cache_invalidation, $wpdb;
if ( ! empty( $_wp_suspend_cache_invalidation ) )
return;
$post = get_post( $post );
if ( empty( $post ) )
return;
wp_cache_delete( $post->ID, 'posts' );
wp_cache_delete( $post->ID, 'post_meta' );
clean_object_term_cache( $post->ID, $post->post_type );
wp_cache_delete( 'wp_get_archives', 'general' );
do_action( 'clean_post_cache', $post->ID, $post );
if ( 'page' == $post->post_type ) {
wp_cache_delete( 'all_page_ids', 'posts' );
wp_cache_delete( 'get_pages', 'posts' );
do_action( 'clean_page_cache', $post->ID );
}
if ( $children = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_type FROM $wpdb->posts WHERE post_parent = %d", $post->ID) ) ) {
foreach ( $children as $child ) {
// Loop detection
if ( $child->ID == $post->ID )
continue;
clean_post_cache( $child );
}
}
if ( is_multisite() )
wp_cache_delete( $wpdb->blogid . '-' . $post->ID, 'global-posts' );
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/clean post cache « WordPress Codex
... from the cache of the post. Will call to clean the term object cache associated with the post ID. clean_post_cache will call itself recursively for each child post.
codex.wordpress.org - #20486 (Pass full post object to clean_post_cache()) – WordPress ...
get_post() in clean_post_cache() isn't much of a problem. We just need to check the the result. If it's empty() then we can assume the post isn't cached.
core.trac.wordpress.org - clean_post_cache Wordpress hook details -- Adam Brown, BYU ...
Detailed information about every action hook and filter used in WordPress. Makes Plugin API easier to use. Lists appearance, file location, and deprecation data ...
adambrown.info - clean_post_cache() WordPress function reference, arguments and ...
clean_post_cache(). 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 ...
queryposts.com