wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_defer_comment_counting › WordPress Function

Since2.5.0
已弃用n/a
wp_defer_comment_counting ( $defer = null )
参数:
  • (bool) $defer
    Required: No
    默认: null
返回:
  • (bool)
定义在:
文档:

Determines whether to defer comment counting.

When setting $defer to true, all post comment counts will not be updated until $defer is set to false. When $defer is set to false, then all previously deferred updated post comment counts will then be automatically updated without having to call wp_update_comment_count() after.


源码

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

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

	return $_defer;
}