Created
March 27, 2018 00:29
-
-
Save rochow/8ca2f92d73c6c1df575fb9ee3ff45725 to your computer and use it in GitHub Desktop.
WordPress - Remove admin email confirmation when updating
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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