wp_defer_term_counting() WordPress Function
The wp_defer_term_counting() function allows you to defer the updating of term count information in the database. This can be useful when you need to update a large number of terms and don't want the overhead of updating the counts for each term. The function takes two parameters: The first parameter is the term_id of the term you want to update. The second parameter is the number of terms you want to update. The function will return an array of the deferred term_ids.
wp_defer_term_counting( bool $defer = null ) #
Enables or disables term counting.
Parameters
- $defer
(bool)(Optional) Enable if true, disable if false.
Default value: null
Return
(bool) Whether term counting is enabled or disabled.
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 codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |