option_update_filter() WordPress Function
The option_update_filter() function is used to filter the new value of an option before it is updated. The function takes two arguments: the new value of the option and the old value of the option. The function can return three values: 1. The new value of the option, which will be stored in the database. 2. The old value of the option, which will not be changed. 3. null, which will cause the option to be deleted from the database.
option_update_filter( array $options ) #
Refreshes the value of the allowed options list available via the ‘allowed_options’ hook.
Description
See the ‘allowed_options’ filter.
Parameters
- $options
(array)(Required)
Return
(array)
Source
File: wp-admin/includes/plugin.php
function option_update_filter( $options ) { global $new_allowed_options; if ( is_array( $new_allowed_options ) ) { $options = add_allowed_options( $new_allowed_options, $options ); } return $options; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.5.0 | $new_whitelist_options was renamed to $new_allowed_options . Please consider writing more inclusive code. |
2.7.0 | Introduced. |