mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 08:11:52 +01:00
Taxonomy: Introduce term_exists_default_query_args
filter.
In [52921] `term_exists` was converted to use `get_terms`. This change adds a filter called `term_exists_default_query_args` to the `term_exists` function to allow developers to modify the arguments passed to `get_terms` before the query is run. Props Chouby, Spacedmonkey, peterwilsoncc. Fixes #55439. Built from https://develop.svn.wordpress.org/trunk@52987 git-svn-id: http://core.svn.wordpress.org/trunk@52576 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
fabc5db7fe
commit
e0570e5753
@ -1559,6 +1559,18 @@ function term_exists( $term, $taxonomy = '', $parent = null ) {
|
||||
$defaults['fields'] = 'all';
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters default arguments for checking if term exists.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $defaults An array of arguments for term_exists.
|
||||
* @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 ID of parent term under which to confine the exists search. Null indicates the search is unconfined.
|
||||
*/
|
||||
$defaults = apply_filters( 'term_exists_default_query_args', $defaults, $term, $taxonomy, $parent );
|
||||
|
||||
if ( is_int( $term ) ) {
|
||||
if ( 0 === $term ) {
|
||||
return 0;
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-alpha-52986';
|
||||
$wp_version = '6.0-alpha-52987';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user