I wanted to set value of WP option (more specifically - 'admin_email') by using plugin, its option (plugin option) and update_option().

I tried using lines like below, but when plugin code contains them - it gets disabled. Any ideas why?

$helper = (get_option('plugin-option');
update_option('admin_email', $helper );


$helper = get_option('plugin-option');
update_option('admin_email', $helper );

Now it's not disabling (due to bracket), but it still doesn't change option value

  • What's the return value? That function returns true/false to indicate if it worked or not – Tom J Nowell Aug 31 '17 at 12:47

That option is special in that WordPress has code to intercept your call for security reasons:


This function intercepts changes to the administrator's email address. It keeps the address from being updated and instead sends the user a confirmation email, with a link to confirm the change.

What you're trying to do could be easily abused, and any change of the administrators email should trigger notices as a basic security measure.

Luckily the documentation for that function also includes an example on how to bypass it


You've got an extra bracket:

$helper = (get_option('plugin-option');

Needs to be

$helper = get_option('plugin-option');
  • Thx, now it doesn't disable. But still - doesn't change option's ( 'admin_email') value. Any ideas about that one? – Bajeczny Aug 31 '17 at 12:41
  • You're setting admin_email to the value of plugin-option. Is plugin-option even an option in the database? And where are you even running this code? – Jacob Peattie Aug 31 '17 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.