WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my site i need to store 200 extra data for each user. Now i know about the user meta option. But is it a good way to save 200extra field for each user?

Or should i create an extra table in the database to do the work.

share|improve this question
I would probably create a new table. It also depends on how often you will need to access the data. – BandonRandon Mar 22 '13 at 4:52
do you need to query users on the data, i.e. get users based on the value of a specific piece of extra data? any data that doesn't need to used in a query can be stored as array within a single field – Milo Mar 22 '13 at 5:00
I only need to get data of a user. No need to do any query using that data. How an array can be saved in field? Can you give me some example url? – Adil Mahmud Choudhury Mar 22 '13 at 5:35

You can store multiple pieces of data within a single field by passing an array rather than a string:

$user_data = array(
    'favorite_color' => 'blue',
    'favorite_animal' => 'cat',
    'favorite_city' => 'paris' 
update_user_meta( $user_id, 'user_data', $user_data );

WordPress will serialize this data for you on save, and unserialize back into an array when it is retrieved:

$user_data = get_user_meta( $user_id, 'user_data', true );
echo $user_data['favorite_color'];

The caveat is that it will actually result in a slightly larger amount of data, but it will decrease the number of rows consumed by the data.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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