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
980
981      /**
982       * Filter a term.
983       *
984       * @since 2.3.0
985       *
986       * @param int|object $_term    Term object or ID.
987       * @param string     $taxonomy The taxonomy slug.
988       */
989      $_term = apply_filters( 'get_term', $_term, $taxonomy );
990
991      /**
992       * Filter a taxonomy.
993       *
994       * The dynamic portion of the filter name, $taxonomy, refers
995       * to the taxonomy slug.
996       *
997       * @since 2.3.0
998       *
 
Line Code
1066      }
1067
1068      $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) );
1069      if ( !$term )
1070           return false;
1071
1072      wp_cache_add($term->term_id, $term, $taxonomy);
1073
1074      /** This filter is documented in wp-includes/taxonomy.php */
1075      $term = apply_filters( 'get_term', $term, $taxonomy );
1076
1077      /** This filter is documented in wp-includes/taxonomy.php */
1078      $term = apply_filters( "get_$taxonomy", $term, $taxonomy );
1079
1080      $term = sanitize_term($term, $taxonomy, $filter);
1081
1082      if ( $output == OBJECT ) {
1083           return $term;
1084      } elseif ( $output == ARRAY_A ) {