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.


Top ↑

Parameters

$options

(array)(Required)


Top ↑

Return

(array)


Top ↑

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;
}


Top ↑

Changelog

Changelog
VersionDescription
5.5.0$new_whitelist_options was renamed to $new_allowed_options. Please consider writing more inclusive code.
2.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.