Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_term

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

This hook occurs 2 times in this file.

Line Code
856                return $null;
857           if ( ! $_term = wp_cache_get($term, $taxonomy) ) {
858                $_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.term_id = %d LIMIT 1", $taxonomy, $term) );
859                if ( ! $_term )
860                     return $null;
861                wp_cache_add($term, $_term, $taxonomy);
862           }
863      }
864
865      $_term = apply_filters('get_term', $_term, $taxonomy);
866      $_term = apply_filters("get_$taxonomy", $_term, $taxonomy);
867      $_term = sanitize_term($_term, $taxonomy, $filter);
868
869      if ( $output == OBJECT ) {
870           return $_term;
871      } elseif ( $output == ARRAY_A ) {
872           $__term = get_object_vars($_term);
873           return $__term;
874      } elseif ( $output == ARRAY_N ) {
 
Line Code
928           return $term;
929      }
930
931      $term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND $field = %s LIMIT 1", $taxonomy, $value) );
932      if ( !$term )
933           return false;
934
935      wp_cache_add($term->term_id, $term, $taxonomy);
936
937      $term = apply_filters('get_term', $term, $taxonomy);
938      $term = apply_filters("get_$taxonomy", $term, $taxonomy);
939      $term = sanitize_term($term, $taxonomy, $filter);
940
941      if ( $output == OBJECT ) {
942           return $term;
943      } elseif ( $output == ARRAY_A ) {
944           return get_object_vars($term);
945      } elseif ( $output == ARRAY_N ) {
946           return array_values(get_object_vars($term));