how to change content of a system email

Hi guys, we’re trying to change the system email that goes out to a user when we change the admin email in General:Settings. Where can we find that email – is there a plugin to change it, or do we have to go into the php code? If you can please tell us at least where it is in the code, that would be greatly appreciated

  • Patrick
    • Support Monkey

    Hi there @mytherapynet

    I hope you’re having a great day!

    The function that contains the email notification is found in

    wordpress/wp-admin/includes/ms.php around line 213.

    You would need to create a custom function to filter the email contents.

    Please let us know if you would need help yo get that done, and we’ll dive in with you.

    Thanks!

  • mytherapynet
    • Site Builder, Child of Zeus

    Hi, I tried changing the content in that area so I could personalize my email, but every time I do it creates an error and crashes the whole site.

    You mention creating a custom function? What would I need to do in order to do that?

    Thank you!

  • Ash
    • WordPress Hacker

    Hello @mytherapynet

    Please try the following code:

    add_filter( 'new_admin_email_content', 'new_content_function' );
    function new_content_function( $email_text, $new_admin_email ) {
    $email_text = "YOUR NEW CONTENT";
    }

    Please note that, in your new content you can use following macro:

    * ###ADMIN_URL### The link to click on to confirm the email change. Required otherwise this functionality will break.
    * ###EMAIL### The new email.
    * ###SITENAME### The name of the site.
    * ###SITEURL### The URL to the site.

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name ‘mu-plugins’. If there is no folder in that name, then create a folder, name it ‘mu-plugins’, create a file inside that, give any name you like and paste the code in there. You don’t need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have.

    Cheers

    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.