Override WordPress Options using a Filter

The basic format for the add_filter function is:

add_filter('pre_option_'.$option, 'override_function_name');

Where $option is the name of the Option as found in the wp_options table of the database.

This example uses a filter to update the admin_email set in Options to that of the current user, so ‘admin_email’ becomes ‘pre_option_admin_email’.

add_filter('pre_option_admin_email', 'override_option_admin_email');
function override_option_admin_email() {
    global $current_user; 
 
    if (!current_user_can('administrator') {
        return false;
    }
    return $current_user->user_email;
}