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
853           $term = (int) $term;
854           if ( ! $_term = wp_cache_get($term, $taxonomy) ) {
855                $_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 = %s LIMIT 1", $taxonomy, $term) );
856                if ( ! $_term )
857                     return $null;
858                wp_cache_add($term, $_term, $taxonomy);
859           }
860      }
861
862      $_term = apply_filters('get_term', $_term, $taxonomy);
863      $_term = apply_filters("get_$taxonomy", $_term, $taxonomy);
864      $_term = sanitize_term($_term, $taxonomy, $filter);
865
866      if ( $output == OBJECT ) {
867           return $_term;
868      } elseif ( $output == ARRAY_A ) {
869           $__term = get_object_vars($_term);
870           return $__term;
871      } elseif ( $output == ARRAY_N ) {
 
Line Code
925           return $term;
926      }
927
928      $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) );
929      if ( !$term )
930           return false;
931
932      wp_cache_add($term->term_id, $term, $taxonomy);
933
934      $term = apply_filters('get_term', $term, $taxonomy);
935      $term = apply_filters("get_$taxonomy", $term, $taxonomy);
936      $term = sanitize_term($term, $taxonomy, $filter);
937
938      if ( $output == OBJECT ) {
939           return $term;
940      } elseif ( $output == ARRAY_A ) {
941           return get_object_vars($term);
942      } elseif ( $output == ARRAY_N ) {
943           return array_values(get_object_vars($term));