• Resolved Mr. Mam

    (@fullstackdevi)


    Hi!

    I had the same problem described here and I found the real solution.

    The problem is if you put multiple terms for one taxonomy, you need to add “relation = OR” to the query:

    Array
    (
        [post_type] => Array
            (
                [0] => event
            )
    
        [post_status] => publish
        [posts_per_page] => -1
        [orderby] => title
        [order] => ASC
        [tax_query] => Array
            (
                [relation] => OR
                [0] => Array
                    (
                        [taxonomy] => event-type
                        [field] => slug
                        [operator] => IN
                        [terms] => Array
                            (
                                [0] => walk
                                [1] => talk
                                [2] => workshop
                            )
    
                    )
    
            )
    
    )

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Ha! I guess I missed the OPs actual intent since I didn’t look too close at their solution, so I had reported the default AND logic worked correctly for me. Thanks for clarifying on a 2.6 year old topic ??

Viewing 1 replies (of 1 total)
  • The topic ‘WP_Query only returns posts that match first term in tax_query array’ is closed to new replies.