[Solved] rest api request including meta_query filter

shanebp Asks: rest api request including meta_query filter
I’m creating a web service using the WP REST API v.2. Is it possible to include something like a meta_query filter when requesting a custom post type?

For example, if I was using WP_Query, I could do this:

$args = array(
    'post_type'         => 'proposal',
    'posts_per_page'    => -1,
    'meta_query'    => array(
            'key'       => 'deadline',
            'value'     => current_time( 'm/d/Y' ),
            'compare'   => '>=',

$proposals_query = new WP_Query( $args );

Is it possible to accomplish the same thing in a REST request? The example goal would be to let the service know that the client wants a response that only includes posts that meet the meta_query conditions. I guess I could send a variable in the request and use that to build a meta_query in a custom endpoint…? So I’m wondering if there is some recommended way to proceed.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.