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.
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:
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:
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.
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.
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.
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.
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.
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.
wp_term_taxonomy stores descriptions of categories, tags and certain links associated with categories.
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.
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.
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.
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.
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.
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
WordPress is developed with the scripting language PHP and uses either MySQL or MariaDB as its open-source relational database management system. Behind the scenes, the WordPress database stores content such…
On WordPress websites, you can easily reset your user password in the admin area or using the “Lost your password?” link displayed on the WordPress login form. Unfortunately, there is…
Are you facing issues with your current hosting and want to move to a new web hosting? Does the process of moving your website to a new host look too…
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.