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 |
|---|---|
| 600 | return $empty_array; |
| 601 | } |
| 602 | |
| 603 | // $args can be whatever, only use the args defined in defaults to compute the key |
| 604 | $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : ''; |
| 605 | $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key ); |
| 606 | |
| 607 | if ( $cache = wp_cache_get( 'get_terms', 'terms' ) ) { |
| 608 | if ( isset( $cache[ $key ] ) ) |
| 609 | return apply_filters('get_terms', $cache[$key], $taxonomies, $args); |
| 610 | } |
| 611 | |
| 612 | if ( 'count' == $orderby ) |
| 613 | $orderby = 'tt.count'; |
| 614 | else if ( 'name' == $orderby ) |
| 615 | $orderby = 't.name'; |
| 616 | else if ( 'slug' == $orderby ) |
| 617 | $orderby = 't.slug'; |
| 618 | else if ( 'term_group' == $orderby ) |
| Line | Code |
| 701 | $terms = $wpdb->get_results($query); |
| 702 | update_term_cache($terms); |
| 703 | } else if ( ('ids' == $fields) || ('names' == $fields) ) { |
| 704 | $terms = $wpdb->get_col($query); |
| 705 | } |
| 706 | |
| 707 | if ( empty($terms) ) { |
| 708 | $cache[ $key ] = array(); |
| 709 | wp_cache_set( 'get_terms', $cache, 'terms' ); |
| 710 | return apply_filters('get_terms', array(), $taxonomies, $args); |
| 711 | } |
| 712 | |
| 713 | if ( $child_of || $hierarchical ) { |
| 714 | $children = _get_term_hierarchy($taxonomies[0]); |
| 715 | if ( ! empty($children) ) |
| 716 | $terms = & _get_term_children($child_of, $terms, $taxonomies[0]); |
| 717 | } |
| 718 | |
| 719 | // Update term counts to include children. |
| Line | Code |
| 733 | unset($terms[$k]); |
| 734 | } |
| 735 | } |
| 736 | } |
| 737 | reset ( $terms ); |
| 738 | |
| 739 | $cache[ $key ] = $terms; |
| 740 | wp_cache_set( 'get_terms', $cache, 'terms' ); |
| 741 | |
| 742 | $terms = apply_filters('get_terms', $terms, $taxonomies, $args); |
| 743 | return $terms; |
| 744 | } |
| 745 | |
| 746 | /** |
| 747 | * Check if Term exists. |
| 748 | * |
| 749 | * Returns the index of a defined term, or 0 (false) if the term doesn't exist. |
| 750 | * |
| 751 | * @package WordPress |