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 |
---|---|
1757 | /** |
1758 | * Filter the given taxonomy's terms cache. |
1759 | * |
1760 | * @since 2.3.0 |
1761 | * |
1762 | * @param array $cache Cached array of terms for the given taxonomy. |
1763 | * @param array $taxonomies An array of taxonomies. |
1764 | * @param array $args An array of get_terms() arguments. |
1765 | */ |
1766 | return apply_filters( 'get_terms', $cache, $taxonomies, $args ); |
1767 | } |
1768 |
|
1769 | $_orderby = strtolower( $args['orderby'] ); |
1770 | if ( 'count' == $_orderby ) { |
1771 | $orderby = 'tt.count'; |
1772 | } elseif ( 'name' == $_orderby ) { |
1773 | $orderby = 't.name'; |
1774 | } elseif ( 'slug' == $_orderby ) { |
1775 | $orderby = 't.slug'; |
Line | Code |
2010 | $terms = $wpdb->get_results($query); |
2011 | if ( 'all' == $_fields ) { |
2012 | update_term_cache( $terms ); |
2013 | } |
2014 |
|
2015 | if ( empty($terms) ) { |
2016 | wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS ); |
2017 |
|
2018 | /** This filter is documented in wp-includes/taxonomy.php */ |
2019 | return apply_filters( 'get_terms', array(), $taxonomies, $args ); |
2020 | } |
2021 |
|
2022 | if ( $child_of ) { |
2023 | foreach ( $taxonomies as $_tax ) { |
2024 | $children = _get_term_hierarchy( $_tax ); |
2025 | if ( ! empty( $children ) ) { |
2026 | $terms = _get_term_children( $child_of, $terms, $_tax ); |
2027 | } |
2028 | } |
Line | Code |
2083 | } |
2084 |
|
2085 | if ( $number && is_array( $terms ) && count( $terms ) > $number ) { |
2086 | $terms = array_slice( $terms, $offset, $number ); |
2087 | } |
2088 |
|
2089 | wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS ); |
2090 |
|
2091 | /** This filter is documented in wp-includes/taxonomy */ |
2092 | return apply_filters( 'get_terms', $terms, $taxonomies, $args ); |
2093 | } |
2094 |
|
2095 | /** |
2096 | * Check if Term exists. |
2097 | * |
2098 | * Formerly is_term(), introduced in 2.3.0. |
2099 | * |
2100 | * @since 3.0.0 |
2101 | * |