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 |
|---|---|
| 1222 | $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key ); |
| 1223 | $last_changed = wp_cache_get('last_changed', 'terms'); |
| 1224 | if ( !$last_changed ) { |
| 1225 | $last_changed = time(); |
| 1226 | wp_cache_set('last_changed', $last_changed, 'terms'); |
| 1227 | } |
| 1228 | $cache_key = "get_terms:$key:$last_changed"; |
| 1229 | $cache = wp_cache_get( $cache_key, 'terms' ); |
| 1230 | if ( false !== $cache ) { |
| 1231 | $cache = apply_filters('get_terms', $cache, $taxonomies, $args); |
| 1232 | return $cache; |
| 1233 | } |
| 1234 | |
| 1235 | $_orderby = strtolower($orderby); |
| 1236 | if ( 'count' == $_orderby ) |
| 1237 | $orderby = 'tt.count'; |
| 1238 | else if ( 'name' == $_orderby ) |
| 1239 | $orderby = 't.name'; |
| 1240 | else if ( 'slug' == $_orderby ) |
| Line | Code |
| 1379 | } |
| 1380 | |
| 1381 | $terms = $wpdb->get_results($query); |
| 1382 | if ( 'all' == $fields ) { |
| 1383 | update_term_cache($terms); |
| 1384 | } |
| 1385 | |
| 1386 | if ( empty($terms) ) { |
| 1387 | wp_cache_add( $cache_key, array(), 'terms', 86400 ); // one day |
| 1388 | $terms = apply_filters('get_terms', array(), $taxonomies, $args); |
| 1389 | return $terms; |
| 1390 | } |
| 1391 | |
| 1392 | if ( $child_of ) { |
| 1393 | $children = _get_term_hierarchy($taxonomies[0]); |
| 1394 | if ( ! empty($children) ) |
| 1395 | $terms = & _get_term_children($child_of, $terms, $taxonomies[0]); |
| 1396 | } |
| 1397 | |
| Line | Code |
| 1431 | $terms = $_terms; |
| 1432 | } |
| 1433 | |
| 1434 | if ( 0 < $number && intval(@count($terms)) > $number ) { |
| 1435 | $terms = array_slice($terms, $offset, $number); |
| 1436 | } |
| 1437 | |
| 1438 | wp_cache_add( $cache_key, $terms, 'terms', 86400 ); // one day |
| 1439 | |
| 1440 | $terms = apply_filters('get_terms', $terms, $taxonomies, $args); |
| 1441 | return $terms; |
| 1442 | } |
| 1443 | |
| 1444 | /** |
| 1445 | * Check if Term exists. |
| 1446 | * |
| 1447 | * Formerly is_term(), introduced in 2.3.0. |
| 1448 | * |
| 1449 | * @package WordPress |