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

Line Code
319           if ( is_object($term) )
320                $term = $term->term_id;
321           $term = (int) $term;
322           if ( ! $_term = wp_cache_get($term, $taxonomy) ) {
323                $_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) );
324                wp_cache_add($term, $_term, $taxonomy);
325           }
326      }
327
328      $_term = apply_filters('get_term', $_term, $taxonomy);
329      $_term = apply_filters("get_$taxonomy", $_term, $taxonomy);
330      $_term = sanitize_term($_term, $taxonomy, $filter);
331
332      if ( $output == OBJECT ) {
333           return $_term;
334      } elseif ( $output == ARRAY_A ) {
335           $__term = get_object_vars($_term);
336           return $__term;
337      } elseif ( $output == ARRAY_N ) {