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
1342
1343      /**
1344       * Filter a term.
1345       *
1346       * @since 2.3.0
1347       *
1348       * @param int|object $_term    Term object or ID.
1349       * @param string     $taxonomy The taxonomy slug.
1350       */
1351      $_term = apply_filters( 'get_term', $_term, $taxonomy );
1352
1353      /**
1354       * Filter a taxonomy.
1355       *
1356       * The dynamic portion of the filter name, `$taxonomy`, refers
1357       * to the taxonomy slug.
1358       *
1359       * @since 2.3.0
1360       *
 
Line Code
1427      }
1428
1429      $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 ) );
1430      if ( ! $term )
1431           return false;
1432
1433      wp_cache_add( $term->term_id, $term, $taxonomy );
1434
1435      /** This filter is documented in wp-includes/taxonomy.php */
1436      $term = apply_filters( 'get_term', $term, $taxonomy );
1437
1438      /** This filter is documented in wp-includes/taxonomy.php */
1439      $term = apply_filters( "get_$taxonomy", $term, $taxonomy );
1440
1441      $term = sanitize_term($term, $taxonomy, $filter);
1442
1443      if ( $output == OBJECT ) {
1444           return $term;
1445      } elseif ( $output == ARRAY_A ) {