Default $args is 'hide_empty' which can be 'hide_empty=true' or array('hide_empty' => true).
Parameters
$argsarray|stringoptional
Array or string of arguments. See WP_Term_Query::__construct() for information on accepted arguments. Default empty array.Default: array()
$deprecatedarray|stringoptional
Argument array, when using the legacy function parameter format. If present, this parameter will be interpreted as $args, and the first function parameter will be parsed as a taxonomy or array of taxonomies. Default empty.Default: ''
Return
string|WP_Error
Numeric string containing the number of terms in that taxonomy or WP_Error if the taxonomy does not exist.
1933functionwp_count_terms($args=array(),$deprecated=''){1934$use_legacy_args=false;19351936// Check whether function is used with legacy signature: `$taxonomy` and `$args`.1937if($args1938&&(is_string($args)&&taxonomy_exists($args)1939||is_array($args)&&wp_is_numeric_array($args))1940){1941$use_legacy_args=true;1942}19431944$defaults=array('hide_empty'=>false);19451946if($use_legacy_args){1947$defaults['taxonomy']=$args;1948$args=$deprecated;1949}19501951$args=wp_parse_args($args,$defaults);19521953// Backward compatibility.1954if(isset($args['ignore_empty'])){1955$args['hide_empty']=$args['ignore_empty'];1956unset($args['ignore_empty']);1957}19581959$args['fields']='count';19601961returnget_terms($args);1962}
History
Introduced in 2.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
5.6.0
Changed the function signature so that the $args array can be provided as the first parameter.from the docblock
2.3.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/wp-includes/taxonomy.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.