admin管理员组

文章数量:1134249

Hello :) I am hoping someone can help me resolve my issue or guide me in the right direction to resolve it. On my WordPress website, I would like to know how to edit the new user email template that I manually created and that is sent to new users. here is an example:

Does anyone know where i can find this template and customize it to add my own content? I would really appreciate any support regarding this topic :)

Thank you!

Hello :) I am hoping someone can help me resolve my issue or guide me in the right direction to resolve it. On my WordPress website, I would like to know how to edit the new user email template that I manually created and that is sent to new users. here is an example:

Does anyone know where i can find this template and customize it to add my own content? I would really appreciate any support regarding this topic :)

Thank you!

Share Improve this question asked Sep 1, 2023 at 17:50 Anthony LuciferoAnthony Lucifero 1
Add a comment  | 

1 Answer 1

Reset to default 0

This is done with the register_new_user filter:

// Replace the default new user notification
remove_action('register_new_user', 'wp_send_new_user_notifications');
add_action('register_new_user', 'my_new_user_email');

You have to remove the default action and register the new function:

Create a new function that builds and sends the message.

function my_new_user_email($user_id, $deprecated = null, $notify = 'user') {
   // create the message
    $message = "Hello new user!";

    // Send the email
    wp_mail(get_userdata($user_id)->user_email, 'Custom Subject', $message);
}

This is placed in the functions.php file of your Child Theme (not the main theme, as any theme update will overwrite your changes).

Make the desired changes to the message text. Add headers to allow for an HTML message. (Lots of googles/bings/ducks on how to do that.)

本文标签: customizationHow to edit the new user email notification template