list_terms_exclusions
Filter HookDescription
Filters the terms to exclude from the terms query.Hook Information
File Location |
wp-includes/class-wp-term-query.php
View on GitHub
|
Hook Type | Filter |
Line Number | 534 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$exclusions
|
`NOT IN` clause of the terms query. |
array
|
$args
|
An array of terms query arguments. |
string[]
|
$taxonomies
|
An array of taxonomy names. |
Usage Examples
Basic Usage
<?php
// Hook into list_terms_exclusions
add_filter('list_terms_exclusions', 'my_custom_filter', 10, 3);
function my_custom_filter($exclusions, $args, $taxonomies) {
// Your custom filtering logic here
return $exclusions;
}
Source Code Context
wp-includes/class-wp-term-query.php:534
- How this hook is used in WordPress core
<?php
529 *
530 * @param string $exclusions `NOT IN` clause of the terms query.
531 * @param array $args An array of terms query arguments.
532 * @param string[] $taxonomies An array of taxonomy names.
533 */
534 $exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args, $taxonomies );
535
536 if ( ! empty( $exclusions ) ) {
537 // Strip leading 'AND'. Must do string manipulation here for backward compatibility with filter.
538 $this->sql_clauses['where']['exclusions'] = preg_replace( '/^\s*AND\s*/', '', $exclusions );
539 }
PHP Documentation
<?php
/**
* Filters the terms to exclude from the terms query.
*
* @since 2.3.0
*
* @param string $exclusions `NOT IN` clause of the terms query.
* @param array $args An array of terms query arguments.
* @param string[] $taxonomies An array of taxonomy names.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/class-wp-term-query.php
Related Hooks
Related hooks will be displayed here in future updates.