Skip to content
Docs
Get RestroPress

Filter

rpress_update_option

Updated
On this page

Filters a value before rpress_update_option() saves it.

Runs inside rpress_update_option() after the current settings are loaded and before the value is stored in the rpress_settings option. It does not run when the value is empty, because an empty value deletes the key instead.

Parameters#

ParameterTypeDescription
$valuemixedThe value about to be saved.
$keystringThe option key being updated.

Return value#

mixed. The value to save.

Example#

function my_update_option_value( $value, $key ) {
	if ( 'currency' === $key && is_string( $value ) ) {
		return strtoupper( $value );
	}
	return $value;
}
add_filter( 'rpress_update_option', 'my_update_option_value', 10, 2 );

Notes#

This filter only applies to rpress_update_option(); saving the settings form goes through the sanitization filters.

Source#

Applied in:

  • includes/admin/settings/register-settings.php (line 56), in rpress_update_option()

See also#

Was this page helpful?