wp_get_object_terms
Filter HookDescription
Filters the terms for a given object or objects. The `$taxonomies` parameter passed to this filter is formatted as a SQL fragment. The {@see 'get_object_terms'} filter is recommended as an alternative.Hook Information
| File Location | wp-includes/taxonomy.phpView on GitHub | 
| Hook Type | Filter | 
| Line Number | 2368 | 
Hook Parameters
| Type | Name | Description | 
|---|---|---|
| WP_Term[]|int[]|string[]|string | $terms | Array of terms or a count thereof as a numeric string. | 
| string | $object_ids | Comma separated list of object IDs for which terms were retrieved. | 
| string | $taxonomies | SQL fragment of taxonomy names from which terms were retrieved. | 
| array | $args | Array of arguments for retrieving terms for the given object(s). See wp_get_object_terms() for details. | 
Usage Examples
                        Basic Usage
                    
                    <?php
// Hook into wp_get_object_terms
add_filter('wp_get_object_terms', 'my_custom_filter', 10, 4);
function my_custom_filter($terms, $object_ids, $taxonomies, $args) {
    // Your custom filtering logic here
    return $terms;
}
Source Code Context
                        wp-includes/taxonomy.php:2368
                        - How this hook is used in WordPress core
                    
                    <?php
2363  	 * @param string                          $object_ids Comma separated list of object IDs for which terms were retrieved.
2364  	 * @param string                          $taxonomies SQL fragment of taxonomy names from which terms were retrieved.
2365  	 * @param array                           $args       Array of arguments for retrieving terms for the given
2366  	 *                                                    object(s). See wp_get_object_terms() for details.
2367  	 */
2368  	return apply_filters( 'wp_get_object_terms', $terms, $object_ids, $taxonomies, $args );
2369  }
2370  
2371  /**
2372   * Adds a new term to the database.
2373   *
PHP Documentation
<?php
/**
	 * Filters the terms for a given object or objects.
	 *
	 * The `$taxonomies` parameter passed to this filter is formatted as a SQL fragment. The
	 * {@see 'get_object_terms'} filter is recommended as an alternative.
	 *
	 * @since 2.8.0
	 *
	 * @param WP_Term[]|int[]|string[]|string $terms      Array of terms or a count thereof as a numeric string.
	 * @param string                          $object_ids Comma separated list of object IDs for which terms were retrieved.
	 * @param string                          $taxonomies SQL fragment of taxonomy names from which terms were retrieved.
	 * @param array                           $args       Array of arguments for retrieving terms for the given
	 *                                                    object(s). See wp_get_object_terms() for details.
	 */
                        Quick Info
                    
                    - Hook Type: Filter
- Parameters: 4
- File: wp-includes/taxonomy.php
                        Related Hooks
                    
                    Related hooks will be displayed here in future updates.
