Enables or disables term counting.
Parameters
$defer
booloptional- Enable if true, disable if false.
Default:
null
Source
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;
}
Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |
Designed to speed up the process of inserting multiple posts during an import by temporarily disabling term counts until all posts have been inserted.
Original trac article: https://core.trac.wordpress.org/ticket/5377