Custom wp-query in wordpress rest api

Question

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&term=9995

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

0
, , user2670708 3 years 2020-04-01T16:51:17-05:00 0 Answers 82 views 0

Leave an answer

Browse
Browse