Support » Fixing WordPress » Selecting from multiple taxonomies

  • I have a complicated query that I need some help on,

    My problem is as follows:

    I need to do a query to show posts that are in both taxonomy 15 and 6 and in one of the others (139,141 or 143), my query is like so:

    Array
    (
        [tax_query] => Array
            (
                [relation] => AND
                [0] => Array
                    (
                        [taxonomy] => book_category
                        [field] => id
                        [terms] => Array
                            (
                                [0] => 15
                                [1] => 6
                            )
    
                        [operator] => IN
                    )
    
                [1] => Array
                    (
                        [taxonomy] => book_category
                        [field] => id
                        [terms] => Array
                            (
                                [0] => 139
                                [0] => 141
                                [0] => 143
                            )
    
                        [operator] => IN
                    )
    
            )
    
    )

    this is passed as tax_query in the WP_Query arguments

  • The topic ‘Selecting from multiple taxonomies’ is closed to new replies.