Title: rest_pre_update_setting
Published: December 6, 2016
Last modified: May 20, 2026

---

# apply_filters( ‘rest_pre_update_setting’, bool $result, string $name, mixed $value, array $args )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/rest_pre_update_setting/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/rest_pre_update_setting/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/rest_pre_update_setting/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/rest_pre_update_setting/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/rest_pre_update_setting/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/rest_pre_update_setting/?output_format=md#wp--skip-link--target)

Filters whether to preempt a setting value update via the REST API.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/rest_pre_update_setting/?output_format=md#description)󠁿

Allows hijacking the setting update logic and overriding the built-in behavior by
returning true.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/rest_pre_update_setting/?output_format=md#parameters)󠁿

 `$result`bool

Whether to override the default behavior for updating the value of a setting.

`$name`string

Setting name (as shown in REST API responses).

`$value`mixed

Updated setting value.

`$args`array

Arguments passed to [register_setting()](https://developer.wordpress.org/reference/functions/register_setting/)
for this setting.

More Arguments from register_setting( … $args )

Data used to describe the setting when registered.

 * `type` string
 * The type of data associated with this setting.
    Valid values are `'string'`, `'
   boolean'`, `'integer'`, `'number'`, `'array'`, and `'object'`.
 * `label` string
 * A label of the data attached to this setting.
 * `description` string
 * A description of the data attached to this setting.
 * `sanitize_callback` callable
 * A callback function that sanitizes the option’s value.
 * `show_in_rest` bool|array
 * Whether data associated with this setting should be included in the REST API.
   
   When registering complex settings, this argument may optionally be an array with
   a `'schema'` key.
 * `default` mixed
 * Default value when calling `get_option()`.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/rest_pre_update_setting/?output_format=md#source)󠁿

    ```php
    $updated = apply_filters( 'rest_pre_update_setting', false, $name, $request[ $name ], $args );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php#L169)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php#L169-L169)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/rest_pre_update_setting/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_REST_Settings_Controller::update_item()](https://developer.wordpress.org/reference/classes/wp_rest_settings_controller/update_item/)`wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php` |

Updates settings for the settings object.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/rest_pre_update_setting/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Frest_pre_update_setting%2F)
before being able to contribute a note or feedback.