Support » Everything else WordPress » Basics of WP database structure

  • I have very basic experience creating and manipulating a single table only mySQL database for storing membership data for a non-profit organization. In other words, my database looked exactly like a simple spreadsheet, but I was able to successfully create my own custom functions with php like this (in plain English):
    1) Look at this table
    2) Find all users who live in XYZ state
    3) Output a lits of those users, displaying their name and state, linking to their full user information.

    Like I said, pretty basic.

    Now I’m trying to work with WordPress but first I need to understand how WordPress stores that data, and then I need to better understand how to work with information contained in multiple tables. Understand so far?

    I see a table called wp_users and it looks just like what I’m used to – a simple spreadsheet. So far so good.

    Now before I go on let me explain that I’ve tried a couple of solutions so far. One is a plug-in that created its own table for user data, and another is a solution that adds custom fields directly to the existing wp_usermeta table. Either way, both solutions seem to work the exact same way, which is totally new to me and here’s where I think I need to start my learning process.


    This table was created by a plug-in but it would be the same story if I were looking at the wp_usermeta table. When I first looked at this table it was sorted by ID. The stored data appeared to be completely random and made no structural sense to me. But then I sorted the USER_ID column I quickly see that for each user, there was exactly 3 FIELD_IDs, 1 for each of the 3 new custom fields I created. OK, that makes more sense to me. But the fact that this was all random looking before I sorted it… is new data just being added to the end in the order it is created no matter what that data is? I just want to make sure I understand this correctly.

    But now my main question before I move on: Even though both solutions I tried worked pretty much the same way, storing additional data in a separate table (and not in user order), I was wondering if it would be any more stable long-term to store the extra data in the existing wp_usermeta table since it’s part of the core installation, rather than one created by a plugin? The plugin gives me a lot of control over the fields I’m creating but I’m not sure if I should be concerned about trusting a 3rd party plug in. When WordPress upgrades in the future, what if this 3rd party plugin doesn’t keep up compatibility? I think my data should still all be safe in there because if the plugin stops working, that table it already created should still be fine, right? The only downside should be that I could lose my ability to change it in the future since that was all done though the plugin. On the flip side, I never had an easy UI plugin to manipulate the creation of new fields in the wp_usermeta solution anyway, but the data may be more “future-proof”. Or maybe not since either way the tables would be safe?

    Any thoughts on whether I should be concerned about using a table newly created by a plugin rather than using the existing wp_usermeta table? My next step after settling on the “safest” solution will be how to actually manipulate this data since I’ve never worked with multiple tables before, but I’ll ask those questions on a mySQL forum instead of here.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Basics of WP database structure’ is closed to new replies.