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
772      }
773
774      $selects = array();
775      if ( 'all' == $fields )
776           $selects = array('t.*', 'tt.*');
777      else if ( 'ids' == $fields )
778           $selects = array('t.term_id', 'tt.parent', 'tt.count');
779      else if ( 'names' == $fields )
780           $selects = array('t.term_id', 'tt.parent', 'tt.count', 't.name');
781         $select_this = implode(', ', apply_filters( 'get_terms_fields', $selects, $args ));
782
783      $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 ORDER BY $orderby $order $limit";
784
785      $terms = $wpdb->get_results($query);
786      if ( 'all' == $fields ) {
787           update_term_cache($terms);
788      }
789
790      if ( empty($terms) ) {