WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
Line | Code |
---|---|
664 | $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key ); |
665 | $last_changed = wp_cache_get('last_changed', 'terms'); |
666 | if ( !$last_changed ) { |
667 | $last_changed = time(); |
668 | wp_cache_set('last_changed', $last_changed, 'terms'); |
669 | } |
670 | $cache_key = "get_terms:$key:$last_changed"; |
671 | $cache = wp_cache_get( $cache_key, 'terms' ); |
672 | if ( false !== $cache ) { |
673 | $cache = apply_filters('get_terms', $cache, $taxonomies, $args); |
674 | return $cache; |
675 | } |
676 |
|
677 | $_orderby = strtolower($orderby); |
678 | if ( 'count' == $_orderby ) |
679 | $orderby = 'tt.count'; |
680 | else if ( 'name' == $_orderby ) |
681 | $orderby = 't.name'; |
682 | else if ( 'slug' == $_orderby ) |
Line | Code |
783 | $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $limit"; |
784 |
|
785 | $terms = $wpdb->get_results($query); |
786 | if ( 'all' == $fields ) { |
787 | update_term_cache($terms); |
788 | } |
789 |
|
790 | if ( empty($terms) ) { |
791 | wp_cache_add( $cache_key, array(), 'terms' ); |
792 | $terms = apply_filters('get_terms', array(), $taxonomies, $args); |
793 | return $terms; |
794 | } |
795 |
|
796 | if ( $child_of ) { |
797 | $children = _get_term_hierarchy($taxonomies[0]); |
798 | if ( ! empty($children) ) |
799 | $terms = & _get_term_children($child_of, $terms, $taxonomies[0]); |
800 | } |
801 |
|
Line | Code |
831 | $terms = $_terms; |
832 | } |
833 |
|
834 | if ( 0 < $number && intval(@count($terms)) > $number ) { |
835 | $terms = array_slice($terms, $offset, $number); |
836 | } |
837 |
|
838 | wp_cache_add( $cache_key, $terms, 'terms' ); |
839 |
|
840 | $terms = apply_filters('get_terms', $terms, $taxonomies, $args); |
841 | return $terms; |
842 | } |
843 |
|
844 | /** |
845 | * Check if Term exists. |
846 | * |
847 | * Returns the index of a defined term, or 0 (false) if the term doesn't exist. |
848 | * |
849 | * @package WordPress |