Support » Plugins » tax_query not working

  • I’m slowly going insane. I just can’t figure out what’s wrong with this code:

    It should output the three pages with the custom taxonomy term I’ve set but instead it outputs all pages. Other query vars like posts_per_page effect the output as expected.

    Any help would greatly be appreciated.

    This is part of a shortcode that I’m not showing, but I’ve done a trouble-shooting and am fairly certain that the tax_query really is the issue.

Viewing 5 replies - 1 through 5 (of 5 total)
  • have you tried to var_dump the $pl_pages variable?

    Never done that before. It looks like it also spits out all the pages (i.e. same output just a lot nastier). Is there anything in particular I should be looking for?

    The taxonomy archives are behaving as expected so the taxonomy is working.

    I’m surprised, but it appears to be a theme issue. Now to figure out what’s going on with the theme…

    Does anyone know what might interfere with a tax_query from the theme side?

    The theme was setting a tax_query to the global $query object. For some reason this was overriding my custom WP_Query object. Despite my best efforts to unset the tax_query var or reset it to null, I just couldn’t do it.

    I ended up having to comment out part of the parent theme which is really not ideal, but it gets me moving on.

    If anyone has ideas on how to more safely modify the theme to fix the behavior, I’m all ears.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘tax_query not working’ is closed to new replies.