WP_REST_Settings_Controller::sanitize_callback()
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_Error
.
Использование
$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 REST Settings Controller::sanitize callback WP 6.2.2
public function sanitize_callback( $value, $request, $param ) { if ( is_null( $value ) ) { return $value; } return rest_parse_request_arg( $value, $request, $param ); }