Filter hook 'get_terms_args'

in WP Core File wp-includes/class-wp-term-query.php at line 408

View Source

get_terms_args

Filter Hook
Description
Filters the terms query arguments.

Hook Information

File Location wp-includes/class-wp-term-query.php View on GitHub
Hook Type Filter
Line Number 408

Hook Parameters

Type Name Description
array $args An array of get_terms() arguments.
string[] $taxonomies An array of taxonomy names.

Usage Examples

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

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

Source Code Context

wp-includes/class-wp-term-query.php:408 - How this hook is used in WordPress core
<?php
 403  		 * @since 3.1.0
 404  		 *
 405  		 * @param array    $args       An array of get_terms() arguments.
 406  		 * @param string[] $taxonomies An array of taxonomy names.
 407  		 */
 408  		$args = apply_filters( 'get_terms_args', $args, $taxonomies );
 409  
 410  		// Avoid the query if the queried parent/child_of term has no descendants.
 411  		$child_of = $args['child_of'];
 412  		$parent   = $args['parent'];
 413  

PHP Documentation

<?php
/**
		 * Filters the terms query arguments.
		 *
		 * @since 3.1.0
		 *
		 * @param array    $args       An array of get_terms() arguments.
		 * @param string[] $taxonomies An array of taxonomy names.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-term-query.php
Related Hooks

Related hooks will be displayed here in future updates.