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 |
---|---|
643 | $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key ); |
644 | $last_changed = wp_cache_get('last_changed', 'terms'); |
645 | if ( !$last_changed ) { |
646 | $last_changed = time(); |
647 | wp_cache_set('last_changed', $last_changed, 'terms'); |
648 | } |
649 | $cache_key = "get_terms:$key:$last_changed"; |
650 |
|
651 | if ( $cache = wp_cache_get( $cache_key, 'terms' ) ) { |
652 | $terms = apply_filters('get_terms', $cache, $taxonomies, $args); |
653 | return $terms; |
654 | } |
655 |
|
656 | if ( 'count' == $orderby ) |
657 | $orderby = 'tt.count'; |
658 | else if ( 'name' == $orderby ) |
659 | $orderby = 't.name'; |
660 | else if ( 'slug' == $orderby ) |
661 | $orderby = 't.slug'; |
Line | Code |
745 | $terms = $wpdb->get_results($query); |
746 | update_term_cache($terms); |
747 | } else if ( ('ids' == $fields) || ('names' == $fields) ) { |
748 | $terms = $wpdb->get_results($query); |
749 | } |
750 |
|
751 | if ( empty($terms) ) { |
752 | $cache[ $key ] = array(); |
753 | wp_cache_set( 'get_terms', $cache, 'terms' ); |
754 | $terms = apply_filters('get_terms', array(), $taxonomies, $args); |
755 | return $terms; |
756 | } |
757 |
|
758 | if ( $child_of ) { |
759 | $children = _get_term_hierarchy($taxonomies[0]); |
760 | if ( ! empty($children) ) |
761 | $terms = & _get_term_children($child_of, $terms, $taxonomies[0]); |
762 | } |
763 |
|
Line | Code |
789 | $terms = $_terms; |
790 | } elseif ( 'names' == $fields ) { |
791 | while ( $term = array_shift($terms) ) |
792 | $_terms[] = $term->name; |
793 | $terms = $_terms; |
794 | } |
795 |
|
796 | wp_cache_add( $cache_key, $terms, 'terms' ); |
797 |
|
798 | $terms = apply_filters('get_terms', $terms, $taxonomies, $args); |
799 | return $terms; |
800 | } |
801 |
|
802 | /** |
803 | * Check if Term exists. |
804 | * |
805 | * Returns the index of a defined term, or 0 (false) if the term doesn't exist. |
806 | * |
807 | * @package WordPress |