register_rest_route
register_rest_route ( $route_namespace, $route, $args = array(), $override = false )
Parameters:- (string) route_namespace The first URL segment after core prefix. Should be unique to your package/plugin.
- (string) route The base URL for route you are adding.
- (array) args Optional. Either an array of options for the endpoint, or an array of arrays for multiple methods. Default empty array.
- (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.
Returns:- (bool) True on success, false on error.
Defined at:Change Log: - Introduced in WordPress: 4.4.0
- Deprecated in WordPress: —
Description
Registers a REST API route.Note: Do not use before the {@see 'rest_api_init'} hook.