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 |
|---|---|
| 1723 | /** |
| 1724 | * Filter the given taxonomy's terms cache. |
| 1725 | * |
| 1726 | * @since 2.3.0 |
| 1727 | * |
| 1728 | * @param array $cache Cached array of terms for the given taxonomy. |
| 1729 | * @param array $taxonomies An array of taxonomies. |
| 1730 | * @param array $args An array of arguments to get terms. |
| 1731 | */ |
| 1732 | $cache = apply_filters( 'get_terms', $cache, $taxonomies, $args ); |
| 1733 | return $cache; |
| 1734 | } |
| 1735 | |
| 1736 | $_orderby = strtolower( $args['orderby'] ); |
| 1737 | if ( 'count' == $_orderby ) { |
| 1738 | $orderby = 'tt.count'; |
| 1739 | } elseif ( 'name' == $_orderby ) { |
| 1740 | $orderby = 't.name'; |
| 1741 | } elseif ( 'slug' == $_orderby ) { |
| Line | Code |
| 1977 | $terms = $wpdb->get_results($query); |
| 1978 | if ( 'all' == $_fields ) { |
| 1979 | update_term_cache( $terms ); |
| 1980 | } |
| 1981 | |
| 1982 | if ( empty($terms) ) { |
| 1983 | wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS ); |
| 1984 | |
| 1985 | /** This filter is documented in wp-includes/taxonomy.php */ |
| 1986 | $terms = apply_filters( 'get_terms', array(), $taxonomies, $args ); |
| 1987 | return $terms; |
| 1988 | } |
| 1989 | |
| 1990 | if ( $child_of ) { |
| 1991 | foreach ( $taxonomies as $_tax ) { |
| 1992 | $children = _get_term_hierarchy( $_tax ); |
| 1993 | if ( ! empty( $children ) ) { |
| 1994 | $terms = _get_term_children( $child_of, $terms, $_tax ); |
| 1995 | } |
| Line | Code |
| 2051 | } |
| 2052 | |
| 2053 | if ( $number && is_array( $terms ) && count( $terms ) > $number ) { |
| 2054 | $terms = array_slice( $terms, $offset, $number ); |
| 2055 | } |
| 2056 | |
| 2057 | wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS ); |
| 2058 | |
| 2059 | /** This filter is documented in wp-includes/taxonomy */ |
| 2060 | $terms = apply_filters( 'get_terms', $terms, $taxonomies, $args ); |
| 2061 | return $terms; |
| 2062 | } |
| 2063 | |
| 2064 | /** |
| 2065 | * Check if Term exists. |
| 2066 | * |
| 2067 | * Formerly is_term(), introduced in 2.3.0. |
| 2068 | * |
| 2069 | * @since 3.0.0 |