Used By
Used By | Description |
---|---|
wp-includes/rest-api.php: rest_sanitize_value_from_schema() | Sanitize a value based on a schema. |
wp-includes/rest-api.php: rest_validate_value_from_schema() | Validate a value based on a schema. |
Converts an object-like value to an object.
(mixed) (Required) The value being evaluated.
(array) Returns the object extracted from the value.
File: wp-includes/rest-api.php
function rest_sanitize_object( $maybe_object ) { if ( '' === $maybe_object ) { return array(); } if ( $maybe_object instanceof stdClass ) { return (array) $maybe_object; } if ( $maybe_object instanceof JsonSerializable ) { $maybe_object = $maybe_object->jsonSerialize(); } if ( ! is_array( $maybe_object ) ) { return array(); } return $maybe_object; }
Version | Description |
---|---|
5.5.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/rest_sanitize_object