WHAT’S IN THIS CHAPTER?
- Understanding the WordPress database
- Learning about database table relationships
- Working with the WordPress database class
- Debugging custom queries
Almost every website on the Internet today is connected to a database that stores information about that website. WordPress is no different and is powered by a MySQL database back end. This database stores all of the data for your website, including your content, users, links, metadata, settings, and more. This chapter covers how data is stored, what data is stored, and how to work with that data in WordPress to help you build amazing websites.
The default installation of WordPress contains 11 database tables. WordPress prides itself on being very lightweight and the database is the foundation for this. The database structure is designed to be very minimal yet allow for endless flexibility when developing and designing for WordPress. To understand the database schema, it helps to view a database diagram.
Figure 6-1 shows an overview of the WordPress database structure and the tables created during a standard WordPress installation. Keep in mind that plugins and themes have the ability to create custom tables. WordPress Multisite also creates additional tables so your WordPress database may contain more tables than just the default WordPress tables.
When a new major release of WordPress is launched, a few database changes are ...