Add cache_domain argument to get_terms() to allow caching to a unique set of cache buckets. Useful when taxonomy queries have been modified via filters and need their own cache space. Props mfields. fixes #13318

git-svn-id: http://svn.automattic.com/wordpress/trunk@18128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2011-06-03 15:24:14 +00:00
parent a7e5e2034f
commit 75660d68a0
1 changed files with 6 additions and 1 deletions

View File

@ -1129,6 +1129,11 @@ function get_term_to_edit( $id, $taxonomy ) {
* The 'parent' argument is different from 'child_of' in that a term X is considered a 'parent'
* of term Y only if term X is the father of term Y, not its grandfather or great-grandfather, etc.
*
* The 'cache_domain' argument enables a unique cache key to be produced when this query is stored
* in object cache. For instance, if you are using one of this function's filters to modify the
* query (such as 'terms_clauses'), setting 'cache_domain' to a unique value will not overwrite
* the cache for similar queries. Default value is 'core'.
*
* @package WordPress
* @subpackage Taxonomy
* @since 2.3.0
@ -1161,7 +1166,7 @@ function &get_terms($taxonomies, $args = '') {
'hide_empty' => true, 'exclude' => array(), 'exclude_tree' => array(), 'include' => array(),
'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '',
'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '',
'pad_counts' => false, 'offset' => '', 'search' => '');
'pad_counts' => false, 'offset' => '', 'search' => '', 'cache_domain' => 'core' );
$args = wp_parse_args( $args, $defaults );
$args['number'] = absint( $args['number'] );
$args['offset'] = absint( $args['offset'] );