WP_REST_Meta_Fields::check_meta_is_array

Advertisement

Summery Summery

Check the ‘meta’ value of a request is an associative array.

Syntax Syntax

WP_REST_Meta_Fields::check_meta_is_array( mixed $value, WP_REST_Request $request, string $param )

Parameters Parameters

$value

(mixed) (Required) The meta value submitted in the request.

$request

(WP_REST_Request) (Required) Full details about the request.

$param

(string) (Required) The parameter name.

Return Return

(array|false) The meta array, if valid, false otherwise.

Source Source

File: wp-includes/rest-api/fields/class-wp-rest-meta-fields.php

		if ( '' === $value && in_array( $schema['type'], array( 'boolean', 'integer', 'number' ), true ) ) {
			$value = static::get_empty_value_for_type( $schema['type'] );
		}

		if ( is_wp_error( rest_validate_value_from_schema( $value, $schema ) ) ) {
			return null;
		}

Advertisement

Changelog Changelog

Changelog
Version Description
4.7.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.