This is a simple WordPress snippet. In this tutorial, I will explain how to send custom admin email for new user registration on WordPress sites.
By default, WordPress sends email to site Administrator when a new user register with your WordPress site, but if you want to another custom email same time, then use the below code and customize the email subject & email message in below code.
Copy the below code and paste it at the end of the functions.php file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <?php //send email notification to site admin when new user registered with site function fm_new_user_registration_email_alert( $user_id ) { $user = get_userdata( $user_id ); $email = $user->user_email; $message = $email . ' has registered to your website.'; } add_action('user_register', 'fm_new_user_registration_email_alert'); ?> |
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: wordpress tutorial, wordpress tutorial for beginner, wordpress tutorial for beginners, wordpress tutorials for beginners, wordpress user, wordpress user registration