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 |
|---|---|
| 1341 | /** |
| 1342 | * Filter the given taxonomy's terms cache. |
| 1343 | * |
| 1344 | * @since 2.3.0 |
| 1345 | * |
| 1346 | * @param array $cache Cached array of terms for the given taxonomy. |
| 1347 | * @param string|array $taxonomies A taxonomy or array of taxonomies. |
| 1348 | * @param array $args An array of arguments to get terms. |
| 1349 | */ |
| 1350 | $cache = apply_filters( 'get_terms', $cache, $taxonomies, $args ); |
| 1351 | return $cache; |
| 1352 | } |
| 1353 | |
| 1354 | $_orderby = strtolower( $args['orderby'] ); |
| 1355 | if ( 'count' == $_orderby ) { |
| 1356 | $orderby = 'tt.count'; |
| 1357 | } else if ( 'name' == $_orderby ) { |
| 1358 | $orderby = 't.name'; |
| 1359 | } else if ( 'slug' == $_orderby ) { |
| Line | Code |
| 1563 | $terms = $wpdb->get_results($query); |
| 1564 | if ( 'all' == $_fields ) { |
| 1565 | update_term_cache($terms); |
| 1566 | } |
| 1567 | |
| 1568 | if ( empty($terms) ) { |
| 1569 | wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS ); |
| 1570 | |
| 1571 | /** This filter is documented in wp-includes/taxonomy.php */ |
| 1572 | $terms = apply_filters( 'get_terms', array(), $taxonomies, $args ); |
| 1573 | return $terms; |
| 1574 | } |
| 1575 | |
| 1576 | if ( $child_of ) { |
| 1577 | $children = _get_term_hierarchy( reset( $taxonomies ) ); |
| 1578 | if ( ! empty( $children ) ) { |
| 1579 | $terms = _get_term_children( $child_of, $terms, reset( $taxonomies ) ); |
| 1580 | } |
| 1581 | } |
| Line | Code |
| 1633 | } |
| 1634 | |
| 1635 | if ( $number && is_array( $terms ) && count( $terms ) > $number ) { |
| 1636 | $terms = array_slice( $terms, $offset, $number ); |
| 1637 | } |
| 1638 | |
| 1639 | wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS ); |
| 1640 | |
| 1641 | /** This filter is documented in wp-includes/taxonomy */ |
| 1642 | $terms = apply_filters( 'get_terms', $terms, $taxonomies, $args ); |
| 1643 | return $terms; |
| 1644 | } |
| 1645 | |
| 1646 | /** |
| 1647 | * Check if Term exists. |
| 1648 | * |
| 1649 | * Formerly is_term(), introduced in 2.3.0. |
| 1650 | * |
| 1651 | * @since 3.0.0 |