wp_cache_post_id_gc()
Хуки из функции
Возвращает
null. Ничего (null).
Использование
wp_cache_post_id_gc( $post_id, $all );
- $post_id(обязательный)
- .
- $all
- .
По умолчанию: 'all'
Код wp_cache_post_id_gc() wp cache post id gc WPSCache 3.0.3
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 ( str_contains( $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;
}