get_terms_defaults

Filters the terms query default arguments.

Description

apply_filters( 'get_terms_defaults', (array) $this_query_var_defaults, (array) $taxonomies ); 

Use to filter the passed arguments.

Parameters (2)

0. $this_query_var_defaults (array)
An array of default get_terms() arguments.
1. $taxonomies (array)
An array of taxonomies.

Usage

To run the hook, copy the example below.
  1. $this_query_var_defaults = apply_filters( 'get_terms_defaults', $this_query_var_defaults, $taxonomies ); 
  2.  
  3. if ( !empty( $this_query_var_defaults ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the get_terms_defaults callback 
  2. function filter_get_terms_defaults( $this_query_var_defaults, $taxonomies ) { 
  3. // make filter magic happen here... 
  4. return $this_query_var_defaults
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'get_terms_defaults', 'filter_get_terms_defaults', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'get_terms_defaults', 'filter_get_terms_defaults', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/class-wp-term-query.php  
  1. $this->query_var_defaults = apply_filters( 'get_terms_defaults', $this->query_var_defaults, $taxonomies );