Make WordPress Core

Opened 6 weeks ago

#54087 new enhancement

A plugin can't change the parameters of a REST API endpoint

Reported by: antonvlasenko Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: REST API Keywords:
Focuses: rest-api Cc:


Sometimes a plugin needs to change the parameters of an already registered REST API endpoint.
Now we need to override the whole WP_REST_Controller::register_routes method to achieve it. Unfortunately, that leads to code duplication, and that is not the best practice.
See an example of this here: https://github.com/WordPress/gutenberg/blob/trunk/lib/class-wp-rest-menu-items-controller.php#L26.

We should add a new filter (add_filter) at the very beginning of the register_rest_route's function body. That filter must allow to modify all arguments of the register_rest_route function.

Change History (0)

Note: See TracTickets for help on using tickets.