WP Query tax_query not returning posts

Ok, I’ve just tested this in my installation (with a taxonomy that exists here). Usually, I just quickly throw stuff into the functions.php and look at the SQL that’s generated (print $event_query->request;). That didn’t work and the tax_query always generated 0 = 1 thus making sure that there were no results.

Finally, heureka, the taxonomy wasn’t registered at that stage. Running it later and it works as expected.

Might something similar happen for you? Is your taxonomy-registration-code maybe working differently based on what page is currently requested?

In any case, please also add the SQL that is generated to the question. That might shine some light. How is your taxonomy added, CPTUI or similar, or your own code?

Maybe throw in

foreach ( get_post_types() as $post_type ) {
   echo '<p>' . $post_type . ": " . var_export(get_object_taxonomies($post_type), true) . '</p>';
}

Just to be sure.