Function: wp_update_term_count

wp_update_term_count( integer | array $terms, string $taxonomy, boolean $do_deferred )

Updates the amount of terms in taxonomy.

Shortcut: wutc

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

If there is a taxonomy callback applied, then it will be called for updating the count.

The default action is to count what the amount of terms have the relationship of term ID. Once that is done, then update the database.

Parameters

Name Type(s) Default Value Description
$terms integer | array

The term_taxonomy_id of the terms.

$taxonomy string

The context of the term.

$do_deferred boolean false

Whether to flush the deferred term counts too. Default false.

Returns

boolean

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

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.