WP_REST_Settings_Controller::sanitize_callback

SummerySummery

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

Syntax

WP_REST_Settings_Controller::sanitize_callback( mixed $value, WP_REST_Request $request, string $param )

DescriptionDescription

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 whitelist the use of null.

ParametersParameters

$value

(mixed) (Required) The value for the setting.

$request

(WP_REST_Request) (Required) The request object.

$param

(string) (Required) The parameter name.

ReturnReturn

(mixed|WP_Error)

SourceSource

File: wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php


			

ChangelogChangelog

Changelog
Version Description
4.7.0 Introduced.
Scroll to Top