How to give OR relation in tax_query and meta_query WordPress

I want give OR relation between tax_query and meta_query. Please check the below given code and help me to find a solution for this.

$post_args = array('post_type' => 'post',
                                'order'     => 'DESC',
                                'meta_query' => array(
                                 'relation'  => 'OR',
                                      array(
                                        'key' => 'client_segment',
                                        'value' =>$client ,
                                        'compare' => 'IN',
                                      ),
                                      array(
                                            'key'  => 'filtered_date',
                                            'value'=> array($start_date, $end_date),
                                            'compare'   => 'BETWEEN'
                                        )
                                    ),
                                    'tax_query' => array(
                                    'relation' => 'OR',
                                    array(
                                        'taxonomy'  => 'category',
                                        'field'     => 'id',
                                        'terms'     => $term_id,
                                        'operator'  => 'IN')

                                        ),

                                );


                         $posts = new WP_Query($post_args);  

Read more here: How to give OR relation in tax_query and meta_query WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *