WordPress.org

Forums

[resolved] Taxonomy Query argument being ignored (3 posts)

  1. Here's my rendered WP_Query:

    array(6) {
    ["post_type"]=> string(10) "cets_event"
    ["order"]=> string(3) "ASC"
    ["orderby"]=> string(14) "meta_value_num"
    ["meta_key"]=> string(14) "_ez_start_date" 
    
    ["meta_query"]=> array(2) {
    [0]=> array(3) { ["key"]=> string(14) "_ez_start_date" ["value"]=> int(1343779200) ["compare"]=> string(1) ">" }
    [1]=> array(3) { ["key"]=> string(14) "_ez_start_date" ["value"]=> int(1346457540) ["compare"]=> string(1) "<" } } 
    
    ["tax_query"]=> array(3) { ["taxonomy"]=> string(19) "cets_event_category" ["field"]=> string(4) "slug" ["terms"]=> string(7) "bluecat" }
    }

    However, the tax_query argument is completely ignored. I get all event posts back, regardless of if it is in that event category or not. Changing the tax_query to any other category, or totally removing it, does not alter my results.

    Any ideas?

  2. Drew Jaynes
    Docs Czar
    Posted 3 years ago #

    tax_query requires an array of arrays. It appears that you're missing one.

    See WP_Query#Taxonomy_Parameters for more info.

  3. Update: tax_query requires an array of arrays. Nested it one more level deep solves the problem.

    Thank you "DrewAPicture" from #wordpress :P

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.