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 |
|---|---|
| 661 | $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key ); |
| 662 | $last_changed = wp_cache_get('last_changed', 'terms'); |
| 663 | if ( !$last_changed ) { |
| 664 | $last_changed = time(); |
| 665 | wp_cache_set('last_changed', $last_changed, 'terms'); |
| 666 | } |
| 667 | $cache_key = "get_terms:$key:$last_changed"; |
| 668 | $cache = wp_cache_get( $cache_key, 'terms' ); |
| 669 | if ( false !== $cache ) { |
| 670 | $cache = apply_filters('get_terms', $cache, $taxonomies, $args); |
| 671 | return $cache; |
| 672 | } |
| 673 | |
| 674 | $_orderby = strtolower($orderby); |
| 675 | if ( 'count' == $_orderby ) |
| 676 | $orderby = 'tt.count'; |
| 677 | else if ( 'name' == $_orderby ) |
| 678 | $orderby = 't.name'; |
| 679 | else if ( 'slug' == $_orderby ) |
| Line | Code |
| 780 | $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ($in_taxonomies) $where ORDER BY $orderby $order $limit"; |
| 781 | |
| 782 | $terms = $wpdb->get_results($query); |
| 783 | if ( 'all' == $fields ) { |
| 784 | update_term_cache($terms); |
| 785 | } |
| 786 | |
| 787 | if ( empty($terms) ) { |
| 788 | wp_cache_add( $cache_key, array(), 'terms' ); |
| 789 | $terms = apply_filters('get_terms', array(), $taxonomies, $args); |
| 790 | return $terms; |
| 791 | } |
| 792 | |
| 793 | if ( $child_of ) { |
| 794 | $children = _get_term_hierarchy($taxonomies[0]); |
| 795 | if ( ! empty($children) ) |
| 796 | $terms = & _get_term_children($child_of, $terms, $taxonomies[0]); |
| 797 | } |
| 798 | |
| Line | Code |
| 828 | $terms = $_terms; |
| 829 | } |
| 830 | |
| 831 | if ( 0 < $number && intval(@count($terms)) > $number ) { |
| 832 | $terms = array_slice($terms, $offset, $number); |
| 833 | } |
| 834 | |
| 835 | wp_cache_add( $cache_key, $terms, 'terms' ); |
| 836 | |
| 837 | $terms = apply_filters('get_terms', $terms, $taxonomies, $args); |
| 838 | return $terms; |
| 839 | } |
| 840 | |
| 841 | /** |
| 842 | * Check if Term exists. |
| 843 | * |
| 844 | * Returns the index of a defined term, or 0 (false) if the term doesn't exist. |
| 845 | * |
| 846 | * @package WordPress |