Right way of storing large number of custom post fields

You could encode them as JSON, or as serialized strings (the latter of which you can do using functions already baked in to WordPress). Both of these options will let you keep the number of database rows down.

However, both of these options will also significantly hamper your ability to search the data, or deal with it meaningfully in other ways if you need to in the future.

It does not matter if you have a large number of rows in your database.

If your site gets to the size where that would be a problem, then your hardware will need to grow accordingly. You will put much more load on your server by processing encoded data (or doing esoteric queries to get the data) in one row than you would if the custom fields were all in their own rows.

WordPress can handle a lot of data – let it 🙂

Leave a Comment