update_option_<option>

Fires after the value of a specific option has been successfully updated.

Description

do_action( 'update_option_<option>', (mixed) $old_value, (mixed) $value, (string) $option ); 

The dynamic portion(s) of the hook name refer to the option name.

Parameters (3)

0. $old_value (mixed)
The old option value.
1. $value (mixed)
The new option value.
2. $option (string)
Option name.

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'update_option_{$option}', $old_value, $value, $option ); 
The following example is for adding a hook callback.
  1. // define the update_option_<option> callback 
  2. function action_update_option_option( $old_value, $value, $option ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( "update_option_{$option}", 'action_update_option_option', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( "update_option_{$option}", 'action_update_option_option', 10, 3 ); 

Defined (1)

The action is defined in the following location(s).

/wp-includes/option.php  
  1. do_action( "update_option_{$option}", $old_value, $value, $option );