• Hello,
    in wordpress 4.6 I made condition arguments for get_posts on price(2 conditions), sku and categories like:

        [meta_query] => Array
            (
                [relation] => AND
                [0] => Array
                    (
                        [key] => _price
                        [value] => Array
                            (
                                [0] => 0
                                [1] => 5
                            )
    
                        [type] => DECIMAL
                        [compare] => BETWEEN
                    )
    
                [1] => Array
                    (
                        [key] => _price
                        [value] => Array
                            (
                                [0] => 50.01
                                [1] => 100
                            )
    
                        [type] => DECIMAL
                        [compare] => BETWEEN
                    )
    
                [2] => Array
                    (
                        [key] => _sku
                        [value] => batte
                        [compare] => like
                    )
    
            )
    
        [tax_query] => Array
            (
                [0] => Array
                    (
                        [taxonomy] => product_cat
                        [field] => id
                        [terms] => Array
                            (
                                [0] => 26
                                [1] => 20
                            )
    
                    )
    
            )

    I set AND conditions, but actually I need OR conditions between 2 prices and AND conditions for the rest of conditions.

    Which is the correct syntax

    Thanks!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘On get_posts I need combination OR AND’ is closed to new replies.