WP_REST_Settings_Controller::sanitize_callback()publicWP 4.7.0

Custom sanitize callback used for all options to allow the use of 'null'.

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 like "type => string". We provide a wrapper sanitizer to allow the use of null.

Метод класса: WP_REST_Settings_Controller{}

Хуков нет.




$WP_REST_Settings_Controller = new WP_REST_Settings_Controller();
$WP_REST_Settings_Controller->sanitize_callback( $value, $request, $param );
$value(разное) (обязательный)
The value for the setting.
$request(WP_REST_Request) (обязательный)
The request object.
$param(строка) (обязательный)
The parameter name.

Список изменений

С версии 4.7.0 Введена.

Код WP_REST_Settings_Controller::sanitize_callback() WP 6.5.3

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

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