get_object_terms

Filters the terms for a given object or objects.

Description

apply_filters( 'get_object_terms', (array) $terms, (array) $object_ids, (array) $taxonomies, (array) $args ); 

Parameters (4)

0. $terms (array)
An array of terms for the given object or objects.
1. $object_ids (array)
Array of object IDs for which $terms were retrieved.
2. $taxonomies (array)
Array of taxonomies from which $terms were retrieved.
3. $args (array)
An array of arguments for retrieving terms for the given object(s). See wp_get_object_terms() for details.

Usage

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

Defined (1)

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

/wp-includes/taxonomy.php  
  1. $terms = apply_filters( 'get_object_terms', $terms, $object_ids, $taxonomies, $args );