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 |
|---|---|
| 1447 | /** |
| 1448 | * Filter the given taxonomy's terms cache. |
| 1449 | * |
| 1450 | * @since 2.3.0 |
| 1451 | * |
| 1452 | * @param array $cache Cached array of terms for the given taxonomy. |
| 1453 | * @param array $taxonomies An array of taxonomies. |
| 1454 | * @param array $args An array of get_terms() arguments. |
| 1455 | */ |
| 1456 | return apply_filters( 'get_terms', $cache, $taxonomies, $args ); |
| 1457 | } |
| 1458 | |
| 1459 | if ( 'count' == $_fields ) { |
| 1460 | return $wpdb->get_var( $query ); |
| 1461 | } |
| 1462 | |
| 1463 | $terms = $wpdb->get_results($query); |
| 1464 | if ( 'all' == $_fields ) { |
| 1465 | update_term_cache( $terms ); |
| Line | Code |
| 1469 | if ( $args['update_term_meta_cache'] ) { |
| 1470 | $term_ids = wp_list_pluck( $terms, 'term_id' ); |
| 1471 | update_termmeta_cache( $term_ids ); |
| 1472 | } |
| 1473 | |
| 1474 | if ( empty($terms) ) { |
| 1475 | wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS ); |
| 1476 | |
| 1477 | /** This filter is documented in wp-includes/taxonomy.php */ |
| 1478 | return apply_filters( 'get_terms', array(), $taxonomies, $args ); |
| 1479 | } |
| 1480 | |
| 1481 | if ( $child_of ) { |
| 1482 | foreach ( $taxonomies as $_tax ) { |
| 1483 | $children = _get_term_hierarchy( $_tax ); |
| 1484 | if ( ! empty( $children ) ) { |
| 1485 | $terms = _get_term_children( $child_of, $terms, $_tax ); |
| 1486 | } |
| 1487 | } |
| Line | Code |
| 1546 | } |
| 1547 | |
| 1548 | wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS ); |
| 1549 | |
| 1550 | if ( 'all' === $_fields ) { |
| 1551 | $terms = array_map( 'get_term', $terms ); |
| 1552 | } |
| 1553 | |
| 1554 | /** This filter is documented in wp-includes/taxonomy.php */ |
| 1555 | return apply_filters( 'get_terms', $terms, $taxonomies, $args ); |
| 1556 | } |
| 1557 | |
| 1558 | /** |
| 1559 | * Adds metadata to a term. |
| 1560 | * |
| 1561 | * @since 4.4.0 |
| 1562 | * |
| 1563 | * @param int $term_id Term ID. |
| 1564 | * @param string $meta_key Metadata name. |