Which action does wp_update_user triggers?

I am working modifying an ecommerce plugin, and it makes uses of wp_update_user() function, and everytime the function runs another table (created by the plugin), gets updated too. The problem is that the updated data on that second table is incorrect, and I am having troubles finding the part of the code that does it.

So I was wondering, does the wp_update_user( ) function triggers some “action” so I can search for that in all the files? like those used in for example:

add_action('wp_logout', 'logout_handler');

Related posts

Leave a Reply

2 comments

  1. wp_update_user() is in /wp-includes/user.php lines 1401-1439. It uses wp_insert_user() (same file, lines 1254-1380) to update the existing user or add a new one if the user doesn’t exist. That function is where the various filters and actions affecting user account info live, and shows everything you can do to the $user object.

  2. If the user is updated this action is called, with these parameters:
    'profile_update', $user_id, $old_user_data );

    Here is the relevant code from user.php in wp_insert_user()

    if ( $update ) {
        /**
         * Fires immediately after an existing user is updated.
         *
         * @since 2.0.0
         *
         * @param int     $user_id       User ID.
         * @param WP_User $old_user_data Object containing user's data prior to update.
         */
        do_action( 'profile_update', $user_id, $old_user_data );
    } else {
        /**
         * Fires immediately after a new user is registered.
         *
         * @since 1.5.0
         *
         * @param int $user_id User ID.
         */
        do_action( 'user_register', $user_id );
    }