wordpress snippets last updated   : January 29, 2015
we now have 646 snippets

Send email notification when profile updates

wordpress snippet

I got a few emails asking about sending an email when a user simply updates the profile. Well here it is, adding this snippet to the functions.php of your wordpress theme will send an email notification to the user when the user profile updates.

snippet :  PHPcopy
function user_profile_update( $user_id ) {
	$site_url = get_bloginfo('wpurl');
        $user_info = get_userdata( $user_id );
        $to = $user_info->user_email; 
        $subject = "Profile Updated: ".$site_url."";
        $message = "Hello " .$user_info->display_name . "\nYour profile has been updated!\n\nThank you for visiting\n ".$site_url."";
        wp_mail( $to, $subject, $message);
add_action( 'profile_update', 'user_profile_update', 10, 2);

Did you like this post? If so please share it with your friends. Thanks!

  • rohit

    its workin perfectly. but mail is showing to spam folder


    • http://wpsnipp.com Kevin Chard

      Not much can be down about that, I would think it has to do with spam settings.