update_sitemeta_cache

函式
update_sitemeta_cache ( $site_ids )
引數
  • (array) $site_ids List of site IDs.
    Required:
返回值
  • (array|false) An array of metadata on success, false if there is nothing to update.
定義位置
相關方法
update_termmeta_cacheupdate_postmeta_cacheupdate_site_cacheupdate_meta_cacheupdate_term_cache
引入
5.1.0
棄用
-

update_sitemeta_cache: 這個函式更新一個站點的後設資料的快取。它通常在網站的後設資料被更新後被呼叫,例如當一個外掛設定被改變時。

更新站點ID列表的後設資料快取。

執行SQL查詢,檢索與`$site_ids`匹配的站點的所有後設資料,並將它們儲存在快取中。隨後呼叫`get_site_meta()`將不需要查詢資料庫。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function update_sitemeta_cache( $site_ids ) {
// Ensure this filter is hooked in even if the function is called early.
if ( ! has_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' ) ) {
add_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' );
}
return update_meta_cache( 'blog', $site_ids );
}
function update_sitemeta_cache( $site_ids ) { // Ensure this filter is hooked in even if the function is called early. if ( ! has_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' ) ) { add_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' ); } return update_meta_cache( 'blog', $site_ids ); }
function update_sitemeta_cache( $site_ids ) {
	// Ensure this filter is hooked in even if the function is called early.
	if ( ! has_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' ) ) {
		add_filter( 'update_blog_metadata_cache', 'wp_check_site_meta_support_prefilter' );
	}
	return update_meta_cache( 'blog', $site_ids );
}

常見問題

FAQs
檢視更多 >