WP_REST_Request

SummerySummery

Core class used to implement a REST request object.

Syntax

WP_REST_Request

DescriptionDescription

Contains data from the request, to be passed to the callback.

Note: This implements ArrayAccess, and acts as an array of parameters when used in that manner. It does not use ArrayObject (as we cannot rely on SPL), so be aware it may have non-array behaviour in some cases.

Note: When using features provided by ArrayAccess, be aware that WordPress deliberately does not distinguish between arguments of the same name for different request methods. For instance, in a request with GET id=1 and POST id=2, $request['id'] will equal 2 (POST) not 1 (GET). For more precision between request methods, use WP_REST_Request::get_body_params(), WP_REST_Request::get_url_params(), etc.

SourceSource

File: wp-includes/rest-api/class-wp-rest-request.php


			

ChangelogChangelog

Changelog
Version Description
4.4.0 Introduced.
Scroll to Top