terms_clauses

Filters the terms query SQL clauses.

Description

apply_filters( 'terms_clauses', (array) $compact, (array) $taxonomies, (array) $args ); 

Parameters (3)

0. $compact (array) => compact( 'fields', 'join', 'where', 'distinct', 'orderby', 'order', 'limits' )
Terms query SQL clauses.
1. $taxonomies (array)
An array of taxonomies.
2. $args (array)
An array of terms query arguments.

Usage

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

Defined (1)

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

/wp-includes/class-wp-term-query.php  
  1. $clauses = apply_filters( 'terms_clauses', compact( 'fields', 'join', 'where', 'distinct', 'orderby', 'order', 'limits' ), $taxonomies, $args );