External – WordPress – Database Schema

Since WordPress is a dynamic PHP-based application, it requires a database to store all the important data. WordPress uses MySQL to manage database tables and it supports MySQL version 5.6 or greater and MariaDB version 10.1 or greater.

You can have a look at the below image to better understand the tables present in the database of a standard WordPress installation and how they are connected –

WordPress Database Structure
Image: WordPress Database Diagram | Courtesy: WordPress.org

You can read more about WordPress Database Schema from the Database Description codex page.

Some things to consider:

  • postmeta, commentmeta, usermeta all act as key-value stores for their respective object types.
    • While it may seem advantageous to directly query term meta, it should be noted that new WP_Query() automatically queries and caches post meta for use with get_post_meta().
  • wp_options is also key-value store, but for the entire site. These are autoloaded and cached in memory by default, unless autoload is set to false using add_option().
  • term_relationships, term_taxonomy, terms, and termmeta work together to provide abstract normalized relationships. Term meta usually has no user interface, except with plugins such as Category and Term Meta Fields, Advanced Custom Fields, or Pods.

References