| 42 | | function wp_count_terms( $taxonomy ) { |
|---|
| 43 | | global $wpdb; |
|---|
| 44 | | |
|---|
| 45 | | return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE taxonomy = '$taxonomy'"); |
|---|
| | 42 | function wp_count_terms( $taxonomy, $args = array() ) { |
|---|
| | 43 | global $wpdb; |
|---|
| | 44 | |
|---|
| | 45 | $defaults = array('ignore_empty' => false); |
|---|
| | 46 | $args = wp_parse_args($args, $defaults); |
|---|
| | 47 | extract($args); |
|---|
| | 48 | |
|---|
| | 49 | $where = ''; |
|---|
| | 50 | if ( $ignore_empty ) |
|---|
| | 51 | $where = 'AND count > 0'; |
|---|
| | 52 | |
|---|
| | 53 | return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE taxonomy = '$taxonomy' $where"); |
|---|