I am making a plugin to push changes in user data to an API every time a profile is updated, be it by the user themselves or from the backend. To do this I am hooking into the "profile_update" action. The problem is that I always get the old data. I have tried changing priority for the hook to something ridiculous to no avail.

I am trying this code on a fairly clean install with WooCommerce:

function action_profile_update( $user_id, $old_user_data ) {
    $fname = get_user_meta( $user_id, 'billing_first_name', true );
add_action( 'profile_update', 'action_profile_update', 80000, 2 );

I am expecting to retrieve the new billing_first_name variable from the database. I am retrieving the old one. Running this again retrieves the one before, but not the new one etc.

The codex says:

"This hook allows you to access data for a user immediately after their database information is updated." My emphasis.

Is this a bug in WordPress?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.