wp_defer_term_counting

函式
wp_defer_term_counting ( $defer = null )
引數
  • (bool) $defer Optional. Enable if true, disable if false.
    Required:
    Default: null
返回值
  • (bool) Whether term counting is enabled or disabled.
定義位置
相關方法
wp_defer_comment_countingwp_update_term_countwp_update_term_count_now_pad_term_countswp_delete_comment
引入
2.5.0
棄用
-

wp_defer_term_counting:此函式的工作方式與wp_defer_comment_counting類似,但適用於分類術語。它將術語計數推遲到必要時,這有助於提高具有大量術語的WordPress站點的效能。

啟用或禁用術語計數。

function wp_defer_term_counting( $defer = null ) {
	static $_defer = false;

	if ( is_bool( $defer ) ) {
		$_defer = $defer;
		// Flush any deferred counts.
		if ( ! $defer ) {
			wp_update_term_count( null, null, true );
		}
	}

	return $_defer;
}

常見問題

FAQs
檢視更多 >