Function: wp_count_terms

wp_count_terms( string $taxonomy, array | string $args )

Count how many terms are in Taxonomy.

Shortcut: wct

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.

Default $args is 'hide_empty' which can be 'hide_empty=true' or array('hide_empty' => true).


Name Type(s) Default Value Description
$taxonomy string

Taxonomy name.

$args array | string array()

Optional. Array of arguments that get passed to get_terms(). Default empty array.


array | integer | WP_Error

Number of terms in that taxonomy or WP_Error if the taxonomy does not exist.

WordPress Developer Newsletter

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