Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_terms_fields

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
990                 break;
991            case 'names':
992                 $selects = array('t.term_id', 'tt.parent', 'tt.count', 't.name');
993                 break;
994            case 'count':
995                $orderby = '';
996                $order = '';
997                 $selects = array('COUNT(*)');
998       }
999     $select_this = implode(', ', apply_filters( 'get_terms_fields', $selects, $args ));
1000
1001      $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where $orderby $order $limit";
1002
1003      if ( 'count' == $fields ) {
1004           $term_count = $wpdb->get_var($query);
1005           return $term_count;
1006      }
1007
1008      $terms = $wpdb->get_results($query);