Filtering multiple custom fields with WP REST API 2

Question

I want to filter posts based on multiple acf custom fields with AND relation. Something like this:

$args = array(
        'post_type'  => 'product',
        'meta_query' => array(
            'relation' => 'AND',
            array(
                'key'     => 'color',
                'value'   => 'blue',
                'compare' => '=',
            ),
            array(
                'key'     => 'price',
                'value'   => array( 20, 100 ),
                'type'    => 'numeric',
                'compare' => 'BETWEEN',
            ),
        ),
    );

I might even have more filters. How can I convert these to REST API 2 filters?

0
, , Sohrab Taee 3 years 2020-04-07T08:51:58-05:00 0 Answers 79 views 0

Leave an answer

Browse
Browse