wpseek.com
WordPress开发者和主题制作者的搜索引擎



rest_validate_null_value_from_schema › WordPress Function

Since5.7.0
已弃用n/a
rest_validate_null_value_from_schema ( $value, $param )
参数: (2)
  • (mixed) $value The value to validate.
    Required: Yes
  • (string) $param The parameter name, used in error messages.
    Required: Yes
返回:
  • (true|WP_Error)
定义在:
文档:

Validates a null value based on a schema.



源码

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

	return true;
}