clean_post_cache
函数
clean_post_cache ( $post )
- 参数
-
-
(int|WP_Post)
$post
Post ID or post object to remove from the cache.- Required: 是
-
(int|WP_Post)
- 定义位置
-
-
wp-includes/post.php
, line 7360
-
wp-includes/post.php
- 引入
- 2.0.0
- 弃用
- –
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.
This function not run if $_wp_suspend_cache_invalidation is not empty. See
wp_suspend_cache_invalidation().
function clean_post_cache( $post ) { global $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } $post = get_post( $post ); if ( ! $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' ); /** * Fires immediately after the given post's cache is cleaned. * * @since 2.5.0 * * @param int $post_id Post ID. * @param WP_Post $post Post object. */ do_action( 'clean_post_cache', $post->ID, $post ); if ( 'page' === $post->post_type ) { wp_cache_delete( 'all_page_ids', 'posts' ); /** * Fires immediately after the given page's cache is cleaned. * * @since 2.5.0 * * @param int $post_id Post ID. */ do_action( 'clean_page_cache', $post->ID ); } wp_cache_set( 'last_changed', microtime(), 'posts' ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。