1558 | | // $args can be whatever, only use the args defined in defaults to compute the key |
1559 | | $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : ''; |
1560 | | $key = md5( $query . $filter_key ); |
1561 | | $last_changed = wp_cache_get( 'last_changed', 'terms' ); |
1562 | | if ( ! $last_changed ) { |
1563 | | $last_changed = microtime(); |
1564 | | wp_cache_set( 'last_changed', $last_changed, 'terms' ); |
1565 | | } |
1566 | | $cache_key = "get_terms:$key:$last_changed"; |
1567 | | $cache = wp_cache_get( $cache_key, 'terms' ); |
1568 | | if ( false !== $cache ) { |
1569 | | |
1570 | | /** |
1571 | | * Filter the given taxonomy's terms cache. |
1572 | | * |
1573 | | * @since 2.3.0 |
1574 | | * |
1575 | | * @param array $cache Cached array of terms for the given taxonomy. |
1576 | | * @param string|array $taxonomies A taxonomy or array of taxonomies. |
1577 | | * @param array $args An array of arguments to get terms. |
1578 | | */ |
1579 | | $cache = apply_filters( 'get_terms', $cache, $taxonomies, $args ); |
1580 | | return $cache; |
1581 | | } |
1582 | | |