When using the CMS, we’re used to relating data through WordPress metadata associations. Sometimes it’s well-used; other times, it’s abused.
If you’ve worked with web development in any other application, there are probably strategies you’ve used to associate data with different types of entities. That is, you’ve likely created tables specifically for the two types of information and then related them in a variety of ways.
It’s completely possible to do this in WordPress, but I think we often jump to either/or conclusions. That is we either think we can use the metadata table for everything or we have to create custom tables.
And, as with many things related to programming, I think it depends on our implementation.
WordPress Metadata Associations
With that said, I do find that there seems to be a shortage of tutorials or information on how to use the existing tables to create and work with WordPress metadata associations and related tasks.
Originally, I was going to set out and write a single post that included:
- some information about the metadata table,
- the idea of entities, posts, pages, post types, users, etc.,
- relating the two in an example scenario,
- and showing illustrations and code for how to do so.
But as I began working on it, it was becoming so long that I wondered if I’d even bother reading it. So, as part of some of the things I’m opting to do with this site this year, I’m going to split up the post into a series.
Maybe it’ll prove useful to some and maybe not. But I’m aiming to cover everything listed above in some form or fashion. This particular post will simply serve as the landing page for the entire series (though I’ll plan to link each part of the series to other parts of the series while working through it).
Finally, I’m not going to assume you know anything more than the following:
- WordPress provides certain tables, and you can interact with them through API functions,
- Post types,
- And hooks.
So all of the above is a long way of saying that I’ve got several posts coming this week all that are too long for a single post, but [hopefully] interesting enough to follow along.
Read The Series? Want More?
If this sounds like your thing, feel free to bookmark this particular post or subscribe to the blog or do whatever you do to keep up with new posts as they are published.