Core Function
View Source on Trac ↗ register_rest_route()
register_rest_route(
mixed $route_namespace,
mixed $route,
mixed $args = array(),
mixed $override = false
) Registers a REST API route.
Parameters 4 required
| Name / Type | Description |
|---|---|
| $route_namespace string | The first URL segment after core prefix. Should be unique to your package/plugin. Required |
| $route string | The base URL for route you are adding. Required |
| array | $args Optional. Either an array of options for the endpoint, or an array of arrays for multiple methods. Default empty array. Required |
| bool | $override Optional. If the route already exists, should we override it? True overrides, false merges (with newer overriding if duplicate keys exist). Default false. Required |
Return Value
(bool)
True on success, false on error.
Function Information
Since Version
4.4.0
Source File
wp-includes/rest-api.php
Advertisement