Programmatically add a custom url route “/category/index.json” to return a collection of posts in json
Turns out i was able to make it work by hooking into parse_request . add_action(‘parse_request’, ‘serve_index_json’, 0); function serve_index_json($wp) { // Exit early if not the right request if (‘my-category-slug/index.json’ !== $wp->request) { return; } $data = array(); $args = [ ‘posts_per_page’ => -1, ‘category_name’ => ‘my-category-slug’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘post_status’ => … Read more