Cannot update newly added User field using wp_update_user

Question

I want to add a new attribute to the wp_user table, "twitter_id" for example.

I added the new column to the wp_user table, and it is added correctly. I get the current user (as I want to edit the value of the logged in user) and the wp_update_user.

$user = wp_get_current_user();
    
$user->twitter_id = "123";

$response = wp_update_user($user);

If I echo out $user->twitter_id, it properly shows the updated value, but the DB does not update.

if I change twitter_id to an existing field, the db is updated with the above code just fine.

How do I update custom fields?

0
DjangoBlockchain 2 months 0 Answers 14 views 0

Leave an answer