
学习如何使用Sublime Text:快速概述
clean_attachment_cache ( $id, $clean_terms = false )
clean_attachment_cache: 这个函数清除了某个附件的缓存。它用于确保附件的最新版本总是被显示。
将清理缓存中的附件。
清理意味着从缓存中删除。也可以选择清理与该附件ID相关的术语对象缓存。
如果$_wp_suspend_cache_invalidation不是空的,这个函数就不会运行。
function clean_attachment_cache( $id, $clean_terms = false ) { global $_wp_suspend_cache_invalidation; if ( ! empty( $_wp_suspend_cache_invalidation ) ) { return; } $id = (int) $id; wp_cache_delete( $id, 'posts' ); wp_cache_delete( $id, 'post_meta' ); if ( $clean_terms ) { clean_object_term_cache( $id, 'attachment' ); } /** * Fires after the given attachment's cache is cleaned. * * @since 3.0.0 * * @param int $id Attachment ID. */ do_action( 'clean_attachment_cache', $id ); }