apply_filters( ‘split_the_query’, bool $split_the_query, WP_Query $query, string $old_request, string[] $clauses )

Filters whether to split the query.

Description

Splitting the query will cause it to fetch just the IDs of the found posts (and then individually fetch each post by ID), rather than fetching every complete row at once. One massive result vs. many small results.

Parameters

$split_the_querybool
Whether or not to split the query.
$queryWP_Query
The WP_Query instance.
$old_requeststring
The complete SQL query before filtering.
$clausesstring[]
Associative array of the clauses for the query.
  • where string
    The WHERE clause of the query.
  • groupby string
    The GROUP BY clause of the query.
  • join string
    The JOIN clause of the query.
  • orderby string
    The ORDER BY clause of the query.
  • distinct string
    The DISTINCT clause of the query.
  • fields string
    The SELECT clause of the query.
  • limits string
    The LIMIT clause of the query.

Source

$split_the_query = apply_filters( 'split_the_query', $split_the_query, $this, $old_request, compact( $pieces ) );

Changelog

VersionDescription
6.6.0Added the $old_request and $clauses parameters.
3.4.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.