rest_is_object() WordPress Function
The rest_is_object() function is used to check whether an object is a rest object. This function is useful for checking whether an object is a rest object before performing any actions on it.
rest_is_object( mixed $maybe_object ) #
Determines if a given value is object-like.
Parameters
- $maybe_object
(mixed)(Required)The value being evaluated.
Return
(bool) True if object like, otherwise false.
Source
File: wp-includes/rest-api.php
function rest_is_object( $maybe_object ) { if ( '' === $maybe_object ) { return true; } if ( $maybe_object instanceof stdClass ) { return true; } if ( $maybe_object instanceof JsonSerializable ) { $maybe_object = $maybe_object->jsonSerialize(); } return is_array( $maybe_object ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.5.0 | Introduced. |