2

I'd like to to extend the wp_users table in my WordPress' database.
Why? I want people to add more information about themselves when they sing up at my website.

I know how to extend it, but I'm afraid that when WordPress needs an update the wp_users table, i.e. the columns I added, will be deleted.

I there anyone here who has some experience with extending the wp_users table?
Will this table be updated when the WordPress version is updated?

  • 4
    Why don’t you want to use user meta fields? – fuxia Apr 19 '13 at 12:39
6

There are far better ways of doing this. Instead of modifying the user table, make use of User Meta. It has a dedicated table, and works the same way as post meta, but for users.

  • add_user_meta
  • get_user_meta
  • update_user_meta

There are many tutorials explaining how to add additional fields to the user profile using User meta to store them, and it's how a lot of standard data is stored already, such as the positions of boxes on the dashboard when you drag them around, how many posts to show at once in the edit screen, or which popups you've clicked dismiss on

  • 1
    Thanks, I didn't knew user_meta existed! I will definitely look to this option, thanks again! :) – Ronny Rook Apr 21 '13 at 21:07
  • So I was looking into the add_user_meta function, and in the codex I found: add_user_meta( $user_id, '_level_of_awesomeness', $awesome_level); But I want to use the data when someone registers, so there is no $user_id yet. Is it still possible to use it in some way then? @tom-j-nowell – Ronny Rook Apr 22 '13 at 7:16
  • that's a new question and one that you should ask as a new question ( hint: asking in comments is a good way of depriving yourself of potential upvotes/reputation from new questions ) – Tom J Nowell Apr 22 '13 at 9:28

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.