Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




clean_post_cache [ WordPress Function ]

clean_post_cache ( $post )
Parameters:
  • (object|int) $post The post object or ID to remove from the cache
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

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics