function wp_update_term_count( $terms, $taxonomy, $do_deferred=false ) {}

Updates the amount of terms in taxonomy.
If there is a taxonomy callback applied, then it will be called for updating the count.


  • int|array $terms: The term_taxonomy_id of the terms
  • string $taxonomy: The context of the term.
  • $do_deferred

Return values

returns:If no terms will return false, and if successful will return true.

Source code

function wp_update_term_count( $terms, $taxonomy, $do_deferred=false ) {

	static $_deferred = array();

	if ( $do_deferred ) {

		foreach ( (array) array_keys($_deferred) as $tax ) {

			wp_update_term_count_now( $_deferred[$tax], $tax );

			unset( $_deferred[$tax] );



	if ( empty($terms) )

		return false;

	if ( !is_array($terms) )

		$terms = array($terms);

	if ( wp_defer_term_counting() ) {

		if ( !isset($_deferred[$taxonomy]) )

			$_deferred[$taxonomy] = array();

		$_deferred[$taxonomy] = array_unique( array_merge($_deferred[$taxonomy], $terms) );

		return true;


	return wp_update_term_count_now( $terms, $taxonomy );



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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: