How to add a custom parameter to a WP API default route?
After a lot of digging I seem to have found a solution myself, and a pretty powerful one, which makes use of a rest_{ post_type }_query filter (replace the { post_type } part with the slug of your custom post type. You can use rest_post_query to alter the default /wp-json/wp/v2/posts request): public function __construct() { … Read more