0

What hook do I use if I want to update a user profile field when a new user is created?

function default_followers() {
// set default follower 

    $current_id = get_current_user_id();
    $key   = 'followers';
    $value  = '1';


    update_user_meta( $current_id, $key, $value);
}

add_action('????????????????', 'default_followers' );

Ive tried: personal_options_update

Ive tried: edit_user_profile_update

Neither seem to work.

1

You'd want to use the user_register hook, which fires immediately after the new user's username and (hashed) password are saved to the DB.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.