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(
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.