rest_validate_null_value_from_schema( mixed $value, string $param )

Validates a null value based on a schema.

Parameters Parameters


(mixed) (Required) The value to validate.


(string) (Required) The parameter name, used in error messages.

Top ↑

Return Return


Top ↑

Source Source

File: wp-includes/rest-api.php

function rest_validate_null_value_from_schema( $value, $param ) {
	if ( null !== $value ) {
		return new WP_Error(
			/* translators: 1: Parameter, 2: Type name. */
			sprintf( __( '%1$s is not of type %2$s.' ), $param, 'null' ),
			array( 'param' => $param )

	return true;

Top ↑

Changelog Changelog

Version Description
5.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.