mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Docs: Improve documentation for WP_REST_Request to highlight a caveat of ArrayAccess when it comes to passing similar arguments for multiple request methods.
Props danielbachhuber, DrewAPicture. Fixes #35799. git-svn-id: https://develop.svn.wordpress.org/trunk@36636 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -16,6 +16,13 @@
|
||||
* 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
|
||||
* {@see WP_REST_Request::get_body_params()}, {@see WP_REST_Request::get_url_params()},
|
||||
* etc.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @see ArrayAccess
|
||||
|
||||
Reference in New Issue
Block a user