How do I change the admin email from without email confirmation

In the Site's "General" Settings you can change the site's admin email. Where emails like new user registration get sent. I would like to update that without having email confirmation from the end user. Is there a way to do force email change, bypassing email confirmation?

  • Patrick
    • Support Monkey

    Hi @barzeen

    If you change that email address, a confirmation email will be sent to that address that you, and only you, must click to confirm that you are the owner of that address.

    Changing the admin email under Settings does not require any sort of confirmation from your users.

    :slight_smile:

  • barzeen
    • Site Builder, Child of Zeus

    Ok you guys aren't understanding. I want to change the admin email to a non-admin user on my sites. So I am the admin, and I want to set the admin email address to different user. Obviously, non-admin users can't access the confirmation page, to confirm their email. I want to bypass that by just setting any email I want as the admin email.

    This admin email I refer to is a setting located under the "General" options of the Settings tab in the admin backend.

  • Patrick
    • Support Monkey

    @barzeen

    I want to change the admin email to a non-admin user on my sites.

    I do understand that. But you cannot bypass the confirmation email for the admin email address. For obvious security concerns, an admin user must confirm ownership of the address you specify in your settings.

    The simplest way around that would be to enter the email address of the user you want, give that user a temporary admin role to confirm ownership of that address, then remove admin role.

  • barzeen
    • Site Builder, Child of Zeus

    @Patrick Cohen, you just fyi you can change the admin email manually from the "Edit Site" function of Network Admin. I don't know why you didn't say that. Now I can change admin emails without getting confirmation from the end user.

    How does wpmudev do it with their edublogs? They obviously want admins to see new user registration, but they don't want them to have full admin privileges. They don't want edublog admins updating wordpress or messing with any serious settings in the wordpress admin, right?

  • Patrick
    • Support Monkey

    @barzeen

    I honestly don't know why I didn't think of that either, lol. Perhaps I was just as stuck as you were in Settings > General of the individual sites. Changing the email address there does require confirmation.

    But you are absolutely right that those emails can easily be edited by the network admin by editing individual sites under Sites > All Sites without confirmation.

    Thanks for the reminder!

  • Gabe
    • The Bug Hunter

    @barzeen @Patrick I'm late on this one, but I think this is what you're looking for to let the admin site email be updated without the email confirmation:

    remove_action( 'add_option_new_admin_email', 'update_option_new_admin_email' );
    remove_action( 'update_option_new_admin_email', 'update_option_new_admin_email' );
    
    /**
     * Disable the confirmation notices when an administrator
     * changes their email address.
     *
     * @see http://codex.wordpress.com/Function_Reference/update_option_new_admin_email
     */
    function wpdocs_update_option_new_admin_email( $old_value, $value ) {
    
        update_option( 'admin_email', $value );
    }
    add_action( 'add_option_new_admin_email', 'wpdocs_update_option_new_admin_email', 10, 2 );
    add_action( 'update_option_new_admin_email', 'wpdocs_update_option_new_admin_email', 10, 2 );

    As an aside, you can also update the admin email for any site without confirmation from the Network Admin > Sites page by clicking Edit for any site. The above would be used to let users edit their own admin email without email confirmation.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.