Support » Fixing WordPress » tax_query operator AND excludes children

  • Hi,

    I just bump into this… bug? I need to run a query to bring posts belonging to multiple categories, they need to have each category selected, so the operator needs to be “AND”. The problem is, I also need to bring the posts that belong to any sub category of a category selected, and this operator is preventing that to happen, even with “include_children” set to true.

    Does anyone know a workaround for this situation?

    Here’s a sample of my arguments array:

    [post_type] => product
     [posts_per_page] => 20
     [paged] => 0
     [tax_query] => Array
                [0] => Array
                        [taxonomy] => category
                        [terms] => Array
                                [0] => 300
                                [1] => 594
                        [operator] => AND
                        [include_children] => 1
     [orderby] => name
     [order] => ASC


Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi alesub,

    I just ran into this same bug, and have been scouring the internet for a fix or alternate method. I was wondering if you’d found a workaround or solution to this? I see your post was several months ago and there aren’t any answers… maybe I shouldn’t be too hopeful.

    Thank you!

    Nope, I couldn’t find a way to sort this out, sorry.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘tax_query operator AND excludes children’ is closed to new replies.