Skip to content

Instantly share code, notes, and snippets.

@rochow
Created March 27, 2018 00:29
Show Gist options
  • Save rochow/8ca2f92d73c6c1df575fb9ee3ff45725 to your computer and use it in GitHub Desktop.
Save rochow/8ca2f92d73c6c1df575fb9ee3ff45725 to your computer and use it in GitHub Desktop.
WordPress - Remove admin email confirmation when updating
<?php
// Disable the confirmation notices when an administrator changes their email address.
// Per http://codex.wordpress.com/Function_Reference/update_option_new_admin_email
// Remove existing hooks
remove_action( 'add_option_new_admin_email', 'update_option_new_admin_email' );
remove_action( 'update_option_new_admin_email', 'update_option_new_admin_email' );
// Add our new hooks
add_action( 'add_option_new_admin_email', 'mr_update_option_new_admin_email', 10, 2 );
add_action( 'update_option_new_admin_email', 'mr_update_option_new_admin_email', 10, 2 );
// On save just directly update it rather than going through confirm process
function mr_update_option_new_admin_email( $old_value, $value ) {
update_option( 'admin_email', $value );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment