Make WordPress Core

Changeset 52987


Ignore:
Timestamp:
03/24/2022 10:24:52 AM (2 years ago)
Author:
spacedmonkey
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r52921 r52987  
    15601560    }
    15611561
     1562    /**
     1563     * Filters default arguments for checking if term exists.
     1564     *
     1565     * @since 6.0.0
     1566     *
     1567     * @param array      $defaults An array of arguments for term_exists.
     1568     * @param int|string $term     The term to check. Accepts term ID, slug, or name.
     1569     * @param string     $taxonomy The taxonomy name to use. An empty string indicates the search is against all taxonomies.
     1570     * @param int|null   $parent   ID of parent term under which to confine the exists search. Null indicates the search is unconfined.
     1571     */
     1572    $defaults = apply_filters( 'term_exists_default_query_args', $defaults, $term, $taxonomy, $parent );
     1573
    15621574    if ( is_int( $term ) ) {
    15631575        if ( 0 === $term ) {
Note: See TracChangeset for help on using the changeset viewer.