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 |
|---|---|
| 1684 | /** |
| 1685 | * Filter the given taxonomy's terms cache. |
| 1686 | * |
| 1687 | * @since 2.3.0 |
| 1688 | * |
| 1689 | * @param array $cache Cached array of terms for the given taxonomy. |
| 1690 | * @param string|array $taxonomies A taxonomy or array of taxonomies. |
| 1691 | * @param array $args An array of arguments to get terms. |
| 1692 | */ |
| 1693 | $cache = apply_filters( 'get_terms', $cache, $taxonomies, $args ); |
| 1694 | return $cache; |
| 1695 | } |
| 1696 | |
| 1697 | $_orderby = strtolower( $args['orderby'] ); |
| 1698 | if ( 'count' == $_orderby ) { |
| 1699 | $orderby = 'tt.count'; |
| 1700 | } else if ( 'name' == $_orderby ) { |
| 1701 | $orderby = 't.name'; |
| 1702 | } else if ( 'slug' == $_orderby ) { |
| Line | Code |
| 1914 | $terms = $wpdb->get_results($query); |
| 1915 | if ( 'all' == $_fields ) { |
| 1916 | update_term_cache( $terms ); |
| 1917 | } |
| 1918 | |
| 1919 | if ( empty($terms) ) { |
| 1920 | wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS ); |
| 1921 | |
| 1922 | /** This filter is documented in wp-includes/taxonomy.php */ |
| 1923 | $terms = apply_filters( 'get_terms', array(), $taxonomies, $args ); |
| 1924 | return $terms; |
| 1925 | } |
| 1926 | |
| 1927 | if ( $child_of ) { |
| 1928 | $children = _get_term_hierarchy( reset( $taxonomies ) ); |
| 1929 | if ( ! empty( $children ) ) { |
| 1930 | $terms = _get_term_children( $child_of, $terms, reset( $taxonomies ) ); |
| 1931 | } |
| 1932 | } |
| Line | Code |
| 1984 | } |
| 1985 | |
| 1986 | if ( $number && is_array( $terms ) && count( $terms ) > $number ) { |
| 1987 | $terms = array_slice( $terms, $offset, $number ); |
| 1988 | } |
| 1989 | |
| 1990 | wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS ); |
| 1991 | |
| 1992 | /** This filter is documented in wp-includes/taxonomy */ |
| 1993 | $terms = apply_filters( 'get_terms', $terms, $taxonomies, $args ); |
| 1994 | return $terms; |
| 1995 | } |
| 1996 | |
| 1997 | /** |
| 1998 | * Check if Term exists. |
| 1999 | * |
| 2000 | * Formerly is_term(), introduced in 2.3.0. |
| 2001 | * |
| 2002 | * @since 3.0.0 |