Make WordPress Core

Ticket #41246: 41246.2.diff

File 41246.2.diff, 1.2 KB (added by spacedmonkey, 7 years ago)
  • src/wp-includes/class-wp-term-query.php

     
    672672
    673673                $this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}";
    674674
     675
     676                /**
     677                 * Filters the terms array before the query takes place.
     678                 *
     679                 * Return a non-null value to bypass WordPress's default term queries.
     680                 *
     681                 * @since 5.1.0
     682                 *
     683                 * @param array|null $results Return an array of term data to short-circuit WP's term query or null to allow WP to run its normal queries.
     684                 * @param WP_Term_Query $this The WP_Term_Query instance (passed by reference).
     685                 */
     686                $this->terms = apply_filters_ref_array( 'terms_pre_query', array( null, &$this ) );
     687                if ( null !== $this->terms ) {
     688                        return $this->terms;
     689                }
     690
    675691                // $args can be anything. Only use the args defined in defaults to compute the key.
    676692                $key          = md5( serialize( wp_array_slice_assoc( $args, array_keys( $this->query_var_defaults ) ) ) . serialize( $taxonomies ) . $this->request );
    677693                $last_changed = wp_cache_get_last_changed( 'terms' );