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 |
---|---|
869 | $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key ); |
870 | $last_changed = wp_cache_get('last_changed', 'terms'); |
871 | if ( !$last_changed ) { |
872 | $last_changed = time(); |
873 | wp_cache_set('last_changed', $last_changed, 'terms'); |
874 | } |
875 | $cache_key = "get_terms:$key:$last_changed"; |
876 | $cache = wp_cache_get( $cache_key, 'terms' ); |
877 | if ( false !== $cache ) { |
878 | $cache = apply_filters('get_terms', $cache, $taxonomies, $args); |
879 | return $cache; |
880 | } |
881 |
|
882 | $_orderby = strtolower($orderby); |
883 | if ( 'count' == $_orderby ) |
884 | $orderby = 'tt.count'; |
885 | else if ( 'name' == $_orderby ) |
886 | $orderby = 't.name'; |
887 | else if ( 'slug' == $_orderby ) |
Line | Code |
1006 | } |
1007 |
|
1008 | $terms = $wpdb->get_results($query); |
1009 | if ( 'all' == $fields ) { |
1010 | update_term_cache($terms); |
1011 | } |
1012 |
|
1013 | if ( empty($terms) ) { |
1014 | wp_cache_add( $cache_key, array(), 'terms' ); |
1015 | $terms = apply_filters('get_terms', array(), $taxonomies, $args); |
1016 | return $terms; |
1017 | } |
1018 |
|
1019 | if ( $child_of ) { |
1020 | $children = _get_term_hierarchy($taxonomies[0]); |
1021 | if ( ! empty($children) ) |
1022 | $terms = & _get_term_children($child_of, $terms, $taxonomies[0]); |
1023 | } |
1024 |
|
Line | Code |
1058 | $terms = $_terms; |
1059 | } |
1060 |
|
1061 | if ( 0 < $number && intval(@count($terms)) > $number ) { |
1062 | $terms = array_slice($terms, $offset, $number); |
1063 | } |
1064 |
|
1065 | wp_cache_add( $cache_key, $terms, 'terms' ); |
1066 |
|
1067 | $terms = apply_filters('get_terms', $terms, $taxonomies, $args); |
1068 | return $terms; |
1069 | } |
1070 |
|
1071 | /** |
1072 | * Check if Term exists. |
1073 | * |
1074 | * Returns the index of a defined term, or 0 (false) if the term doesn't exist. |
1075 | * |
1076 | * Formerly is_term(), introduced in 2.3.0. |