Demystifying the Database

We often hear about WordPress core in reference to the code base, but the true core of WordPress is its database. The database design that supports all WordPress code makes it easy for developers to extend the WordPress platform and build truly amazing websites.

There’s just one shortfall, though – very few people take the time to get to know the database.

During this presentation, we’re going to go on a deep dive into how the WordPress database is structured as well as how that relates to the codebase. Specifically, we’re going to look at a clear and easy-to-understand look at how the database structure fits the different methods and strategies that data architects live by.

After we’ve got a firm grasp on the lay of the land, we’re going to look at how the default WordPress database schema can be utilized for custom features. Many things fit nicely without needing to make any changes to the database whatsoever; some things may be best served by custom tables. We’ll talk about where to draw the line and how to make that decision.

With a firm understanding of the database’s role, we’ll look at how it relates to the standard WP Query and The Loop™. This functionality is integral to WordPress and drives how literally every URL request gets served by WordPress (when hitting uncached URLs, that is). Once we’re settled on standard behavior we’ll also look at how the $wpdb class can be used to run any number of custom MySQL operations on a site.

Finally, we’ll circle back on creating custom tables and review some best practices. MySQL supports a large variety of data types and, if you’re not intimately familiar with them, it can be difficult to choose the best type for what you’re storing. We’ll also talk about striking a balance between tables that have long rows (many columns) versus smaller tables that share relatable data.

There is much to cover here, thanks to the versatility of WordPress. You’re bound to learn something valuable whether you’re just getting into development or you’ve been working with WordPress and MySQL for years.

What You’ll Learn

  • The structure of the WordPress database and its relationship with WordPress core.
  • How the structure of the WordPress database fits in with methodologies employed by data architects.
  • How the tables in the database can be utilized for custom features.
  • How the database relates to The Query and The Loop
  • How to access the database directly using the $wpdb class
  • Best practices for use of the database for custom solutions.