清除博客详细信息缓存。
refresh_blog_details(int $blog_id)
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$blog_id | (int) | 可选 | 博客ID。默认为当前博客。 |
返回(Return)
无返回值
源码(Source)
/**
* Clear the blog details cache.
*
* @since MU
*
* @param int $blog_id Optional. Blog ID. Defaults to current blog.
*/
function refresh_blog_details( $blog_id = 0 ) {
$blog_id = (int) $blog_id;
if ( ! $blog_id ) {
$blog_id = get_current_blog_id();
}
$details = get_blog_details( $blog_id, false );
if ( ! $details ) {
// Make sure clean_blog_cache() gets the blog ID
// when the blog has been previously cached as
// non-existent.
$details = (object) array(
'blog_id' => $blog_id,
'domain' => null,
'path' => null
);
}
clean_blog_cache( $details );
/**
* Fires after the blog details cache is cleared.
*
* @since 3.4.0
*
* @param int $blog_id Blog ID.
*/
do_action( 'refresh_blog_details', $blog_id );
}
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
MU (3.0.0) | wp-includes/ms-blogs.php:273 | 0 | 2 |