Using tax_query creates a 1 = 0 or 1 = 1 in $wp_query->request

The 0 = 1 happens when the terms don’t exist.

You’re creating a query for some set of terms. Before it can add the SQL to that main query, it first does a secondary query to get the term_id’s for the relevant terms. If none are found, then it returns 0 = 1 instead, to shortcut the main query because no terms match the request.

Leave a Comment