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 |
|---|---|
| 1628 | /** |
| 1629 | * Filter the given taxonomy's terms cache. |
| 1630 | * |
| 1631 | * @since 2.3.0 |
| 1632 | * |
| 1633 | * @param array $cache Cached array of terms for the given taxonomy. |
| 1634 | * @param array $taxonomies An array of taxonomies. |
| 1635 | * @param array $args An array of get_terms() arguments. |
| 1636 | */ |
| 1637 | return apply_filters( 'get_terms', $cache, $taxonomies, $args ); |
| 1638 | } |
| 1639 | |
| 1640 | if ( 'count' == $_fields ) { |
| 1641 | return $wpdb->get_var( $query ); |
| 1642 | } |
| 1643 | |
| 1644 | $terms = $wpdb->get_results($query); |
| 1645 | if ( 'all' == $_fields ) { |
| 1646 | update_term_cache( $terms ); |
| Line | Code |
| 1650 | if ( $args['update_term_meta_cache'] ) { |
| 1651 | $term_ids = wp_list_pluck( $terms, 'term_id' ); |
| 1652 | update_termmeta_cache( $term_ids ); |
| 1653 | } |
| 1654 | |
| 1655 | if ( empty($terms) ) { |
| 1656 | wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS ); |
| 1657 | |
| 1658 | /** This filter is documented in wp-includes/taxonomy.php */ |
| 1659 | return apply_filters( 'get_terms', array(), $taxonomies, $args ); |
| 1660 | } |
| 1661 | |
| 1662 | if ( $child_of ) { |
| 1663 | foreach ( $taxonomies as $_tax ) { |
| 1664 | $children = _get_term_hierarchy( $_tax ); |
| 1665 | if ( ! empty( $children ) ) { |
| 1666 | $terms = _get_term_children( $child_of, $terms, $_tax ); |
| 1667 | } |
| 1668 | } |
| Line | Code |
| 1732 | } |
| 1733 | |
| 1734 | wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS ); |
| 1735 | |
| 1736 | if ( 'all' === $_fields ) { |
| 1737 | $terms = array_map( 'get_term', $terms ); |
| 1738 | } |
| 1739 | |
| 1740 | /** This filter is documented in wp-includes/taxonomy.php */ |
| 1741 | return apply_filters( 'get_terms', $terms, $taxonomies, $args ); |
| 1742 | } |
| 1743 | |
| 1744 | /** |
| 1745 | * Adds metadata to a term. |
| 1746 | * |
| 1747 | * @since 4.4.0 |
| 1748 | * |
| 1749 | * @param int $term_id Term ID. |
| 1750 | * @param string $meta_key Metadata name. |