Custom wp-query in wordpress rest api

For example I have a query with tax and metas and other stuff..

how I can pass it to the rest api so i can call all the data with one call

for example this function

function load_special_args() {
$args = array(
‘post_type’ => ‘post’,
‘order’ => ‘DESC’,
‘posts_per_page’ => 100,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘category’,
‘field’ => ‘term_id’,
‘terms’ => ‘9995’,
),
),
);
return $args;
}

imaging call:
/wp/v2/posts?args=load_special_args

Because I want a special use i dont want to use the
/wp/v2/posts?categories=id

Read more here:: Custom wp-query in wordpress rest api

Leave a Reply

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