wp_defer_term_counting( bool $defer = null )
Enable or disable term counting.
Description Description
Parameters Parameters
- $defer
-
(bool) (Optional) Enable if true, disable if false.
Default value: null
Return Return
(bool) Whether term counting is enabled or disabled.
Source Source
File: wp-includes/taxonomy.php
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;
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
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