dlovas
10/7/2017 - 2:18 PM

wp_query multiple meta_query arguments

WP_Query with multiple meta_queries joined by AND

$args = array(
    'post_type' => 'produkty',
    'meta_query' => array(
            'relation' => 'AND',
            array(
                    'key' => 'field_name_1',
                    'value' => '1',
                    'compare' => '='),
            array(
                    'key' => 'field_name_2',
                    'value' => '1',
                    'compare' => '=')
            )
);
$query = new WP_Query( $args );