serve_request() public method

Matches the current server URI to a route and runs the first matching callback then outputs a JSON representation of the returned value.
See also: WP_REST_Server::dispatch()
Since: 4.4.0
public serve_request ( string $path = null ) : false | null
$path string Optional. The request route. If not set, `$_SERVER['PATH_INFO']` will be used. Default null.
return false | null Null if not served and a HEAD request, false otherwise.
Esempio n. 1
 public function serve_request($path = null)
     $result = parent::serve_request($path);
     $this->sent_body = ob_get_clean();
     return $result;