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.
2774functionwp_defer_comment_counting($defer=null){2775static$_defer=false;27762777if(is_bool($defer)){2778$_defer=$defer;2779// Flush any deferred counts.2780if(!$defer){2781wp_update_comment_count(null,true);2782}2783}27842785return$_defer;2786}
History
Introduced in 2.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/comment.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.