rest_get_server

Advertisement

Summery Summery

Retrieves the current REST server instance.

Syntax Syntax

rest_get_server()

Description Description

Instantiates a new instance if none exists already.

Return Return

(WP_REST_Server) REST server instance.

Source Source

File: wp-includes/rest-api.php

 * @param string $scheme Optional. Sanitization scheme. Default 'rest'.
 * @return string Full URL to the endpoint.
 */
function rest_url( $path = '', $scheme = 'rest' ) {
	return get_rest_url( null, $path, $scheme );
}

/**
 * Do a REST request.
 *
 * Used primarily to route internal requests through WP_REST_Server.
 *
 * @since 4.4.0
 *
 * @param WP_REST_Request|string $request Request.
 * @return WP_REST_Response REST response.
 */
function rest_do_request( $request ) {
	$request = rest_ensure_request( $request );
	return rest_get_server()->dispatch( $request );
}

/**
 * Retrieves the current REST server instance.
 *
 * Instantiates a new instance if none exists already.
 *
 * @since 4.5.0
 *
 * @global WP_REST_Server $wp_rest_server REST server instance.
 *
 * @return WP_REST_Server REST server instance.
 */

Advertisement

Changelog Changelog

Changelog
Version Description
4.5.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.