function wp_defer_comment_counting($defer=null) {}

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.


  • bool $defer

Source code

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;



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: