I need to store an extra value for users. I have made an extra field on the users page and on the "add new user" page. When adding a new user the extra value is stored using "update_user_meta":

update_user_meta($user_id, 'new_value', $_POST['the new value']);

I addded such a value, but after logging out the user and logging in it seems that this meta value is empty. I printed the meta values with

print_r(get_user_meta( 12 ));

which prints all meta values. So are meta values only stored temporarily? Then what is the use of them?

I need to store an extra user value permanently, in the same way as "email" for example - how do I do? edit: On the other hand - user "first_name" and "last_name" are saved as meta values, and these values are not lost. So how can I make custom meta values get saved?

Edit: It is solved - I didn't realize that I had another action on 'profile_update' which overwrote the value when user was updated on the user page. So I only had to get rid of the second action:

add_action('user_register', 'save_custom_user_profile_fields');
add_action('profile_update', 'save_custom_user_profile_fields');
  • I did it some time ago based on this tutorial. Are those the steps you do, too?
    – flomei
    Commented Nov 18, 2015 at 9:02
  • Okay - do you know in what database table the "profile fields" are saved?
    – Galivan
    Commented Nov 18, 2015 at 9:40

1 Answer 1


update_user_meta will store the value permanently, as you are expecting. How ever in your case, there are multiple scenerio where you can loose those data. Thats the reason you are seeing empty result.

First check when are you running the update_user_meta. Is it on every page request. If so then $_POST['the new value'] shouldn't be empty. If it is empty then the empty value will be updated.

so please check your time of update_user_meta execution and at that time whether $_POST['the new value'] available or not.

Additional Note: If the field is user updateable then while pringting the meta box echo the correct value. If it not printing the value then there will be empty value posting to your save funtion.

If none of the above gives you any clue. Penter code herelease post your full code.

  • Thanks!! You're completely right, I had forgotten that I had two "add_actions", one for 'user_register' and the other for 'profile_update', and the profile update will overwrite the custom value with "".
    – Galivan
    Commented Nov 18, 2015 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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