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 |
|---|---|
| 1242 | $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key ); |
| 1243 | $last_changed = wp_cache_get('last_changed', 'terms'); |
| 1244 | if ( !$last_changed ) { |
| 1245 | $last_changed = time(); |
| 1246 | wp_cache_set('last_changed', $last_changed, 'terms'); |
| 1247 | } |
| 1248 | $cache_key = "get_terms:$key:$last_changed"; |
| 1249 | $cache = wp_cache_get( $cache_key, 'terms' ); |
| 1250 | if ( false !== $cache ) { |
| 1251 | $cache = apply_filters('get_terms', $cache, $taxonomies, $args); |
| 1252 | return $cache; |
| 1253 | } |
| 1254 | |
| 1255 | $_orderby = strtolower($orderby); |
| 1256 | if ( 'count' == $_orderby ) |
| 1257 | $orderby = 'tt.count'; |
| 1258 | else if ( 'name' == $_orderby ) |
| 1259 | $orderby = 't.name'; |
| 1260 | else if ( 'slug' == $_orderby ) |
| Line | Code |
| 1399 | } |
| 1400 | |
| 1401 | $terms = $wpdb->get_results($query); |
| 1402 | if ( 'all' == $fields ) { |
| 1403 | update_term_cache($terms); |
| 1404 | } |
| 1405 | |
| 1406 | if ( empty($terms) ) { |
| 1407 | wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS ); |
| 1408 | $terms = apply_filters('get_terms', array(), $taxonomies, $args); |
| 1409 | return $terms; |
| 1410 | } |
| 1411 | |
| 1412 | if ( $child_of ) { |
| 1413 | $children = _get_term_hierarchy($taxonomies[0]); |
| 1414 | if ( ! empty($children) ) |
| 1415 | $terms = _get_term_children($child_of, $terms, $taxonomies[0]); |
| 1416 | } |
| 1417 | |
| Line | Code |
| 1451 | $terms = $_terms; |
| 1452 | } |
| 1453 | |
| 1454 | if ( 0 < $number && intval(@count($terms)) > $number ) { |
| 1455 | $terms = array_slice($terms, $offset, $number); |
| 1456 | } |
| 1457 | |
| 1458 | wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS ); |
| 1459 | |
| 1460 | $terms = apply_filters('get_terms', $terms, $taxonomies, $args); |
| 1461 | return $terms; |
| 1462 | } |
| 1463 | |
| 1464 | /** |
| 1465 | * Check if Term exists. |
| 1466 | * |
| 1467 | * Formerly is_term(), introduced in 2.3.0. |
| 1468 | * |
| 1469 | * @package WordPress |