Run function AFTER theme options are saved?

Use the filter update_option_{$option}. It runs after a successful saving.

$option is the name of your option, and you get the old and the new value as parameters.

From wp-includes/option.php:

do_action( "update_option_{$option}", $oldvalue, $_newvalue );

Use it like this for an option wpse_themesettings:

add_action( 'update_option_wpse_themesettings', 'wpse_check_settings', 10, 2 );

function wpse_check_settings( $old_value, $new_value )
{
    // do something
}

Leave a Comment