Title: rest_is_object
Published: August 11, 2020
Last modified: February 24, 2026

---

# rest_is_object( mixed $maybe_object ): bool

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/rest_is_object/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/rest_is_object/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/rest_is_object/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/rest_is_object/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/rest_is_object/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/rest_is_object/?output_format=md#wp--skip-link--target)

Determines if a given value is object-like.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/rest_is_object/?output_format=md#parameters)󠁿

 `$maybe_object`mixedrequired

The value being evaluated.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/rest_is_object/?output_format=md#return)󠁿

 bool True if object like, otherwise false.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/rest_is_object/?output_format=md#source)󠁿

    ```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 );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/rest-api.php#L1617)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/rest-api.php#L1617-L1631)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/rest_is_object/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_REST_Posts_Controller::prepare_tax_query()](https://developer.wordpress.org/reference/classes/wp_rest_posts_controller/prepare_tax_query/)`wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php` |

Prepares the ‘tax_query’ for a collection of posts.

  | 
| [rest_validate_object_value_from_schema()](https://developer.wordpress.org/reference/functions/rest_validate_object_value_from_schema/)`wp-includes/rest-api.php` |

Validates an object value based on a schema.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/rest_is_object/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Frest_is_object%2F)
before being able to contribute a note or feedback.