do_action( 'profile_update', int $user_id, WP_User $old_user_data )

Fires immediately after an existing user is updated.


Parameters Parameters

$user_id

(int) User ID.

$old_user_data

(WP_User) Object containing user's data prior to update.


Top ↑

Source Source

File: wp-includes/user.php

View on Trac



Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 2 content
    Contributed by Uriahs Victor

    Finding out if a user email was updated from the admin dashboard, can work for other fields as well if value being checked is changed:

    function wpdocs_check_user_email_updated( $user_id, $old_user_data ) {
    	$old_user_email = $old_user_data->data->user_email;
    
    	$user = get_userdata( $user_id );
    	$new_user_email = $user->user_email;
    
    	if ( $new_user_email !== $old_user_email ) {
    		// Do something if old and new email aren't the same
    	}
    }
    add_action( 'profile_update', 'wpdocs_check_user_email_updated', 10, 2 );
    
    

You must log in before being able to contribute a note or feedback.