term_exists_default_query_args
Filters default query arguments for checking if a term exists.
Usage
add_filter( 'term_exists_default_query_args', 'wp_kama_term_exists_default_query_args_filter', 10, 4 ); /** * Function for `term_exists_default_query_args` filter-hook. * * @param array $defaults An array of arguments passed to get_terms(). * @param int|string $term The term to check. Accepts term ID, slug, or name. * @param string $taxonomy The taxonomy name to use. An empty string indicates the search is against all taxonomies. * @param int|null $parent_term ID of parent term under which to confine the exists search. Null indicates the search is unconfined. * * @return array */ function wp_kama_term_exists_default_query_args_filter( $defaults, $term, $taxonomy, $parent_term ){ // filter... return $defaults; }
- $defaults(array)
- An array of arguments passed to get_terms().
- $term(int|string)
- The term to check. Accepts term ID, slug, or name.
- $taxonomy(string)
- The taxonomy name to use. An empty string indicates the search is against all taxonomies.
- $parent_term(int|null)
- ID of parent term under which to confine the exists search. Null indicates the search is unconfined.
Changelog
Since 6.0.0 | Introduced. |
Where the hook is called
term_exists_default_query_args
wp-includes/taxonomy.php 1613
$defaults = apply_filters( 'term_exists_default_query_args', $defaults, $term, $taxonomy, $parent_term );