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');