Send Email Notification in WordPress when User Updates Profile

WordPress have default functions send emails to users, besides using that we can also write custom functions. Here is a WordPress snippet which will send email notification to user when they updated their profile. To enable email notification for profile updates you need to copy and paste the following code to your functions.php. Once added the code your WP site can send emails to users for their profile updates.

<?php 
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 = "Hi " .$user_info->display_name . "\nYour profile has been successfully updated!";
        wp_mail( $to, $subject, $message);
}
add_action( 'profile_update', 'user_profile_update', 10, 2);
?>

Related posts:

Partner with Us

We are providing an exclusive partnership offer to individuals and companies who are interested in setting up their own web design & development company. For more information about how to partner with us, please contact us