Definition:
function wp_count_terms( $taxonomy, $args = array() {}
Count how many terms are in Taxonomy.
Default $args is ‘hide_empty’ which can be ‘hide_empty=true’ or array(‘hide_empty’ => true).
Parameters
- string $taxonomy: Taxonomy name
- array|string $args: Overwrite defaults. See get_terms()
Return values
returns:How many terms are in $taxonomy
Source code
function wp_count_terms( $taxonomy, $args = array() ) {
$defaults = array('hide_empty' => false);
$args = wp_parse_args($args, $defaults);
// backwards compatibility
if ( isset($args['ignore_empty']) ) {
$args['hide_empty'] = $args['ignore_empty'];
unset($args['ignore_empty']);
}
$args['fields'] = 'count';
return get_terms($taxonomy, $args);
}
3503

February 12, 2011 


No comments yet... Be the first to leave a reply!