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

Fires immediately after an existing user is updated.


Parameters

$user_id int
User ID.
$old_user_data WP_User
Object containing user's data prior to update.
$userdata array
The raw array of data passed to wp_insert_user() .
More Arguments from wp_insert_user( ... $userdata ) An array, object, or WP_User object of user data arguments.
  • IDint
    User ID. If supplied, the user will be updated.
  • user_passstring
    The plain-text user password.
  • user_loginstring
    The user's login username.
  • user_nicenamestring
    The URL-friendly user name.
  • user_urlstring
    The user URL.
  • user_emailstring
    The user email address.
  • display_namestring
    The user's display name.
    Default is the user's username.
  • nicknamestring
    The user's nickname.
    Default is the user's username.
  • first_namestring
    The user's first name. For new users, will be used to build the first part of the user's display name if $display_name is not specified.
  • last_namestring
    The user's last name. For new users, will be used to build the second part of the user's display name if $display_name is not specified.
  • descriptionstring
    The user's biographical description.
  • rich_editingstring
    Whether to enable the rich-editor for the user.
    Accepts 'true' or 'false' as a string literal, not boolean. Default 'true'.
  • syntax_highlightingstring
    Whether to enable the rich code editor for the user.
    Accepts 'true' or 'false' as a string literal, not boolean. Default 'true'.
  • comment_shortcutsstring
    Whether to enable comment moderation keyboard shortcuts for the user. Accepts 'true' or 'false' as a string literal, not boolean. Default 'false'.
  • admin_colorstring
    Admin color scheme for the user. Default 'fresh'.
  • use_sslbool
    Whether the user should always access the admin over https. Default false.
  • user_registeredstring
    Date the user registered in UTC. Format is 'Y-m-d H:i:s'.
  • user_activation_keystring
    Password reset key. Default empty.
  • spambool
    Multisite only. Whether the user is marked as spam.
    Default false.
  • show_admin_bar_frontstring
    Whether to display the Admin Bar for the user on the site's front end. Accepts 'true' or 'false' as a string literal, not boolean. Default 'true'.
  • rolestring
    User's role.
  • localestring
    User's locale. Default empty.
  • meta_inputarray
    Array of custom user meta values keyed by meta key.
    Default empty.

Top ↑

Source

File: wp-includes/user.php. View all references

do_action( 'profile_update', $user_id, $old_user_data, $userdata );


Top ↑

Changelog

Changelog
Version Description
5.8.0 The $userdata parameter was added.
2.0.0 Introduced.

Top ↑

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.