Filter hook 'wp_get_object_terms_args'

in WP Core File wp-includes/taxonomy.php at line 2301

View Source

wp_get_object_terms_args

Filter Hook
Description
Filters arguments for retrieving object terms.

Hook Information

File Location wp-includes/taxonomy.php View on GitHub
Hook Type Filter
Line Number 2301

Hook Parameters

Type Name Description
array $args An array of arguments for retrieving terms for the given object(s). See {@see wp_get_object_terms()} for details.
int[] $object_ids Array of object IDs.
string[] $taxonomies Array of taxonomy names to retrieve terms from.

Usage Examples

Basic Usage
<?php
// Hook into wp_get_object_terms_args
add_filter('wp_get_object_terms_args', 'my_custom_filter', 10, 3);

function my_custom_filter($args, $object_ids, $taxonomies) {
    // Your custom filtering logic here
    return $args;
}

Source Code Context

wp-includes/taxonomy.php:2301 - How this hook is used in WordPress core
<?php
2296  	 * @param array    $args       An array of arguments for retrieving terms for the given object(s).
2297  	 *                             See {@see wp_get_object_terms()} for details.
2298  	 * @param int[]    $object_ids Array of object IDs.
2299  	 * @param string[] $taxonomies Array of taxonomy names to retrieve terms from.
2300  	 */
2301  	$args = apply_filters( 'wp_get_object_terms_args', $args, $object_ids, $taxonomies );
2302  
2303  	/*
2304  	 * When one or more queried taxonomies is registered with an 'args' array,
2305  	 * those params override the `$args` passed to this function.
2306  	 */

PHP Documentation

<?php
/**
	 * Filters arguments for retrieving object terms.
	 *
	 * @since 4.9.0
	 *
	 * @param array    $args       An array of arguments for retrieving terms for the given object(s).
	 *                             See {@see wp_get_object_terms()} for details.
	 * @param int[]    $object_ids Array of object IDs.
	 * @param string[] $taxonomies Array of taxonomy names to retrieve terms from.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/taxonomy.php
Related Hooks

Related hooks will be displayed here in future updates.