rest_ensure_request

Advertisement

Summery Summery

Ensures request arguments are a request object (for consistency).

Syntax Syntax

rest_ensure_request( array|string|WP_REST_Request $request )

Parameters Parameters

$request

(Required) Request to check.

Return Return

(WP_REST_Request) REST request instance.

Source Source

File: wp-includes/rest-api.php

		 *
		 * @since 4.4.0
		 *
		 * @param string $class_name The name of the server class. Default 'WP_REST_Server'.
		 */
		$wp_rest_server_class = apply_filters( 'wp_rest_server_class', 'WP_REST_Server' );
		$wp_rest_server       = new $wp_rest_server_class;

		/**
		 * Fires when preparing to serve an API request.
		 *

Advertisement

Changelog Changelog

Changelog
Version Description
5.3.0 Accept string argument for the request path.
4.4.0 Introduced.

Advertisement

Leave a Reply