Beginner’s Guide to WordPress Database Schema and Structure

Bulletproof Backups for Your WordPress Website

Fortify your business continuity with foolproof WordPress backups. No data loss, no downtime — just secure, seamless operation.

WordPress Database Schema

Launched over a decade ago, WordPress has become the world’s most popular website building platform. Installing WordPress and running the site doesn’t require any knowledge of the underlying structure. But there are times you will find yourself in a situation where some knowledge of WordPress database schema is required. In this article, we’ll give you a tour of the WordPress database structure. Show you behind the scenes of how data is stored.

[lwptoc skipHeadingLevel=”h3,h4,h5,h6″ skipHeadingText=”Conclusion”]

What is WordPress Database?

A database is created whenever you build a WordPress website. Everything on your WordPress website, be it posts, custom post type, pages, comments, and even settings are stored in a database. It’s like a warehouse of information. All your data is placed in an organized manner so that it’s easy to find them. An image of a typical warehouse that comes to mind is that of rows and rows of cardboard boxes. The boxes are kept on storage shelves. In a WordPress database, the shelves are known as tables.

There are 11 tables by default on a new WordPress website. Every table can store only specific data. For instance, the wp comments table captures all information left by a person commenting on a post like IP Address, comment author slug, etc. Storing data in a specific table makes it faster and easier to find them.

In the next section, we are going to walk you through every WordPress table and show you which tables are responsible for the content on your WordPress website.

 

WordPress Database Tables

A brand new WordPress website has 11 tables. Those are:

  1. wp_posts
  2. wp_postmeta
  3. wp_options
  4. wp_users
  5. wp_usermeta
  6. wp_term_taxonomy
  7. wp_terms
  8. wp_term_relationships
  9. wp_links
  10. wp_comments
  11. wp_commentmeta

Many of the tables are related to one another. One piece of data can be related to other data, for instance, a post can be associated with categories and tags. So the table that stored blog posts will share a relationship with the tables where category and tags are stored.

Before we start describing what the tables store and how they are connected to each other, here’s a graphical structure of WordPress database:

WordPress database schema
Graphical presentation of WordPress tables and how they are connected to each other
The database is an integral part of a WordPress website. For developers & website builders, it's necessary to have knowledge of how the database is structured and how it works. Share on X

1. wp_posts

Since types of content from your posts and pages is stored in this table, it’s arguably the most important table in the WordPress database. The content types include text, revisions, menu items, media attachments, and any custom items.

2. wp_postmeta

It’s an extension of the wp_ posts table. It stores extra information from posts. Some plugins store data within this table. The social sharing plugin MashShare stores share counts of specific posts in this table.

Note: Throughout the database, there are many such tables that enable the WordPress core or a theme or plugin to store extra information.

3. wp_options

The options table is a different kind of table. Instead of storing the content of the website, it stores the settings of the site. This table stores your website configurations like the site title, tagline, and timezone. It typically stores the settings of plugins and themes as well. Unlike other tables, the wp_options table doesn’t really share a relationship with any of the other tables.

4. wp_users

The wp_users table stores the list of all registered users of your WordPress website. As a result, it saves basic information like their username, WordPress passwords, email ID, display name, time of registration, etc.

5. wp_usermeta

WordPress stores extra information about users in the wp_usermeta table. For instance, the last name of a user is saved in the wp_usermeta table instead of the wp_users table.

6. wp_terms

The wp_terms table stores categories for both posts and pages and tags for posts. Links related to categories are also present here. The wp_terms table shares a relationship with wp_term_taxonomy and wp_term_relationships table.

7. wp_term_taxonomy

wp_term_taxonomy stores descriptions of categories, tags and certain links associated with categories.

8. wp_term_relationships

The wp_term_relationships table helps maintain relationships. For instance, in this post, the one that you are reading, is associated with a few tags and a category. The wp_term_relationships table helps maintain this association.

9. wp_links

Links are powerful. They are like letters of recommendation.

Up until a few years ago, blogrolls were fashionable. A blogroll is a list of external links that appear in the sidebar of a website. Back then, WordPress believed that site owners will choose wisely when linking to another website. But instead, site owners began abusing blogrolls and hence WordPress removed the feature.

Blogrolls link section in the sidebar
There’s Blogroll section in the sidebar

The wp_links table stores information related to blogrolls.

Since blogrolls are no longer in use, it’s strange to still find the wp_links table. It’s mainly for folks who are using older versions of WordPress.

10. wp_comments

Both approved and unapproved comments left on your posts and pages are stored in this table. Specific data about the author like the author name, email address, type of comment (whether it’s a simple comment, pingback or trackback) are also saved in this table.

Furthermore, it’s important to note that if you are using a third-party comment service like Disqus, comments won’t be stored in this table, they’ll be saved on the commenting system’s own server.

11. wp_commentmeta

Extra data about the comments left on your website like which post is the comment associated with are stored here.

That’s the final table in the WordPress database of a new website.

It’s important to note that if you are checking the database of an old website, there’s bound to be more than 11 tables.

The more time you spent time running a website, the more information you add. As a result, your database becomes bigger. New tables are added to the database to support certain functions on a website. Gravity Forms, for instance, creates its own WordPress database table once you install it on your website. However, not all plugins add tables to the database. Many utilize those already present.

 

WordPress Database For Multisite

In a WordPress multisite, there are multiple websites on the same WordPress installation. But the interesting part is that the install will have a single database. Of course, there will be more tables and different types of connections between them. In the next section, we’ll cover all the changes that appear on your database after you moved your single site to a multisite.

Immediately after setting up the multisite, you’ll notice a huge difference in the way the database tables look. A standard WordPress database has 11 tables and all the tables were storing a single site’s content. Now that you have a multitude of WordPress sites (generally called subsites), the number of tables will increase.

Multisite tables look very different from tables present on a normal WordPress website. Let’s have a look at the tables created in a multisite network:

WordPress Multisite Tables

  • wp_site: The table contains information about the network like IDs assigned to each subsite, path of the site, etc.
  • wp_sitemeta: This one contains extra information about the network like site name, admin email, admin user ID, etc.
  • wp_blogs: Every subsite is stored in this table. All information associated with the subsites like time and date when the blog was registered or was last updated if the blog is publicly visible or archived etc. is stored here.
  • wp_blog_versions: The table records the WordPress version of the subsites. So that when you are upgrading the version of WordPress, it knows which sites need the upgrade and which ones don’t.
  • wp_signups: wp_signups table stores information about registered users of the multisite. But in a multisite network, you have the option to disable the registration of new users. If registration is disabled, you won’t see any data in this table.
  • wp_registration_log: This table stores information of the admin user who creates a new subsite.

 

Conclusion

The database is an integral part of a WordPress website. Because it stores all the information needed to run a website. For plugin or WordPress developers, it’s necessary to have knowledge of how the database works. But we believe that any WordPress user should know the basics of the database as it’s an integral part of their website.

You can visit the database and check out the tables by logging into your WordPress hosting account and selecting phpMyAdmin from your cPanel. But before you do this, we recommend taking a backup. That’s because visiting the database is risky and the slightest misstep can break your site. Once you have WordPress backups in place you needn’t worry about this. You can create a database backup manually but it’s a time-consuming exercise. Using a plugin is your best bet. For more WordPress tutorials follow our blog.

Visit your database without a worry,
Try BlogVault Backup Plugin Now!

You may also like


Fix: WordPress 403 Forbidden
Fix: WordPress 403 Forbidden

Stuck with a “403 Forbidden” error while trying to access your WordPress site? It’s a little scary and quite cumbersome but you can troubleshoot WordPress errors like this.  It’s a…

Fix: WordPress 413 Request Entity Too Large
Fix: WordPress 413 Request Entity Too Large

Fixing errors in WordPress site is like hitting a digital roadblock. It can be frustrating and disruptive. But, you’re also left wondering why this is happening to you.  The “413…

How do you update and backup your website?

Creating Backup and Updating website can be time consuming and error-prone. BlogVault will save you hours everyday while providing you complete peace of mind.

Updating Everything Manually?

But it’s too time consuming, complicated and stops you from achieving your full potential. You don’t want to put your business at risk with inefficient management.

Backup Your WordPress Site

Install the plugin on your website, let it sync and you’re done. Get automated, scheduled backups for your critical site data, and make sure your website never experiences downtime again.