WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] tax_query not working (6 posts)

  1. mrwweb
    Member
    Posted 2 years ago #

    I'm slowly going insane. I just can't figure out what's wrong with this code: http://pastebin.com/XuPydjBk

    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.

  2. gwinh.lopez
    Member
    Posted 2 years ago #

    have you tried to var_dump the $pl_pages variable?

  3. mrwweb
    Member
    Posted 2 years ago #

    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?

  4. mrwweb
    Member
    Posted 2 years ago #

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

  5. mrwweb
    Member
    Posted 2 years ago #

    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?

  6. mrwweb
    Member
    Posted 2 years ago #

    Resolution:
    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.

Topic Closed

This topic has been closed to new replies.

About this Topic