wp_cache_post_id_gc() WPSCache 1.0
Хуки из функции
Возвращает
Null. Ничего.
Использование
wp_cache_post_id_gc( $post_id, $all );
Код wp_cache_post_id_gc() wp cache post id gc WPSCache 1.7.1
function wp_cache_post_id_gc( $post_id, $all = 'all' ) {
$post_id = intval( $post_id );
if( $post_id == 0 )
return true;
$permalink = trailingslashit( str_replace( get_option( 'home' ), '', get_permalink( $post_id ) ) );
if ( false !== strpos( $permalink, '?' ) ) {
wp_cache_debug( 'wp_cache_post_id_gc: NOT CLEARING CACHE. Permalink has a "?". ' . $permalink );
return false;
}
$dir = get_current_url_supercache_dir( $post_id );
wp_cache_debug( "wp_cache_post_id_gc post_id: $post_id " . get_permalink( $post_id ) . " clearing cache in $dir.", 4 );
if ( $all ) {
prune_super_cache( $dir, true, true );
do_action( 'gc_cache', 'prune', $permalink );
@rmdir( $dir );
$supercache_home = get_supercache_dir();
wp_cache_debug( "wp_cache_post_id_gc clearing cache in {$supercache_home}page/." );
prune_super_cache( $supercache_home . 'page/', true );
do_action( 'gc_cache', 'prune', 'page/' );
} else {
wp_cache_debug( "wp_cache_post_id_gc clearing cached index files in $dir.", 4 );
prune_super_cache( $dir, true, true );
do_action( 'gc_cache', 'prune', $permalink );
}
return true;
}