Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_terms

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
491      if ( $parent ) {
492           $hierarchy = _get_term_hierarchy($taxonomies[0]);
493           if ( !isset($hierarchy[$parent]) )
494                return array();
495      }
496
497      $key = md5( serialize( $args ) . serialize( $taxonomies ) );
498      if ( $cache = wp_cache_get( 'get_terms', 'terms' ) ) {
499           if ( isset( $cache[ $key ] ) )
500                return apply_filters('get_terms', $cache[$key], $taxonomies, $args);
501      }
502
503      if ( 'count' == $orderby )
504           $orderby = 'tt.count';
505      else if ( 'name' == $orderby )
506           $orderby = 't.name';
507      else
508           $orderby = 't.term_id';
509
 
Line Code
607                     unset($terms[$k]);
608                }
609           }
610      }
611      reset ( $terms );
612
613      $cache[ $key ] = $terms;
614      wp_cache_set( 'get_terms', $cache, 'terms' );
615
616      $terms = apply_filters('get_terms', $terms, $taxonomies, $args);
617      return $terms;
618 }
619
620 /**
621  * is_term() - Check if Term exists
622  *
623  * Returns the index of a defined term, or 0 (false) if the term doesn't exist.
624  *
625  * @global $wpdb Database Object