We launched the multi-tenant WordPress Marketplace! 🎉

Update the WP admin E-mail without confirmation

sybren@wpcs.io

Want to update the WP admin E-mail for your tenants without confirmation?

One of the general WordPress settings is the “Admin E-mail”. It is the E-mail that is used for things like error reporting and verifications. To change it, the previous E-mail will have to manually agree with the change. This is unfeasible if you are creating multiple tenants a day for external clients.

To automate this process, you will have to update two options: admin_email and new_admin_email. An example snippet to run via a PHP snippets plugin is as follows:

<?php
add_action('plugins_loaded', function() {
    $new_email = 'my-email@example.com';
    update_option('admin_email', $new_email);
    update_option('new_admin_email', $new_email);
});

After activating this snippet and refreshing a WordPress page, you should see the Admin E-mail changed without requiring confirmation. This code needs to run on the site that you want to change the Admin E-mail of, likely a tenant site. That means, depending on your use case, you could use a PHP snippet plugin or a custom plugin to deploy this snippet to your tenants. You can read more about upgrading tenants here.

NOTE

In this example, the Admin E-mail is updated using the hook plugins_loaded. This is probably not the hook you will want to use. Which one you should use, however, depends entirely on your use case.

Build a low code SaaS today

Start a 30-day free trial – Cancel anytime

Plugin name

Author

WPCS

Description

One of the general WordPress settings is the “Admin E-mail”. It is the E-mail that is used for things like error reporting and verifications. To change it, the previous E-mail will have to manually agree with the change. This is unfeasible if you are creating multiple tenants a day for external clients.

Code Snippet