Archives

Prevent Option From Being Updated

If you need to hand over the reins to a client, but want to make sure certain options stay unchanged, you can add this code:

add_filter( 'pre_update_option_admin_email', 'prevent_option_change', 10, 2 ); 
function prevent_option_change( $newvalue, $oldvalue ) {
    return $oldvalue;
}

In this case, I’m preserving ‘admin_email’ – just change that part of the filter hook to preserve another option.