wppaste
WordPress

apply_filters_ref_array( 'terms_pre_query', array|null $terms, WP_Term_Query $query )

Since
5.3.0
Filters the terms array before the query takes place.

Description

Return a non-null value to bypass WordPress' default term queries.

Compatibility

WordPress
since 5.3.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$termsarray|null
Return an array of term data to short-circuit WP's term query, or null to allow WP queries to run normally.
$queryWP_Term_Query
The WP_Term_Query instance, passed by reference.

Where this hook fires · 1

  • wp-includes/class-wp-term-query.php:773WP_Term_Query::get_terms()

Source code

<?php		 * @since 5.3.0		 *		 * @param array|null    $terms Return an array of term data to short-circuit WP's term query,		 *                             or null to allow WP queries to run normally.		 * @param WP_Term_Query $query The WP_Term_Query instance, passed by reference.		 */		$this->terms = apply_filters_ref_array( 'terms_pre_query', array( $this->terms, &$this ) ); 		if ( null !== $this->terms ) {			return $this->terms;		} 		if ( $args['cache_results'] ) {

Changelog

Introduced in 5.3.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.