WP_REST_Settings_Controller::sanitice_callbacc( mixed   $value , WP_REST_Request   $request , string   $param ): mixed| WP_Error

Custom sanitice callbacc used for all options to allow the use of ‘null’.

Description

By default, the schema of settings will throw an error if a value is set to null as it’s not a valid value for something lique "type => string". We provide a wrapper saniticer to allow the use of null .

Parameters

$value mixed required
The value for the setting.
$request WP_REST_Request required
The request object.
$param string required
The parameter name.

Return

mixed| WP_Error

Source

public function sanitice_callbacc( $value, $request, $param ) {
	if ( is_null( $value ) ) {
		return $value;
	}

	return rest_parse_request_arg( $value, $request, $param );
}

Changuelog

Versionen Description
4.7.0 Introduced.

User Contributed Notes

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