Storage Racks

Where WordPress Pages Are Stored

What You'll Learn

WordPress has several main components. The most basic components are files and a database. The files create the structure and the functions. The files basically make up the programming of your site.  To us, there are bigger components like the themes, the plugins, and the content, or pages.  Today we are going to talk about where WordPress pages are stored. While you don’t need to know that to use WordPress, it doesn’t hurt to know so that you can understand what will happen if you make other changes.

What The Pages Are

For us today, when we talk about pages we are talking about the content that you add. We are also talking about both pages and posts. WordPress sees them the same way. Pages and posts are stored exactly the same except one type are labeled as a “page” and the other is a “post”.

In fact, if you use WooCommerce, products and orders are stored the same way too.  Of course they have different labels and different  content but they’re all the same to WordPress.

Where WordPress Pages Are Stored

To put it simply, WordPress pages are stored in the database. WordPress saves a record for each page (or post, etc but I’m not going to keep saying that).  It basically consists of the content,  the title, etc. In fact, when you’re editing the page, if you look at the URL, you will see the number that WordPress uses to find the database record.

Editing URL with Page ID Highlighted

WordPress also saves some other things too. This information is called metadata. Metadata is a cool sounding term that basically means saving data about data. Some of this is flexible. Some plugins use this data. 

Post Information in the Database
Here’s a sample of what post metadata looks like in the database

This is why if you ever change themes you don’t have to rewrite your pages and posts again. The content is still there. It might be ugly but it will work. Often, it works just fine unless the page had a lot of styling and design to it.

RELATED:   How to Update PHP in WordPress

Cleaning the Database

WordPress does some other cool things too. For example, if you save edits to the page, so that it can keep a record of changes, WordPress, will save a new record but save that it overwrote the old one. So, post number 5 overwrites post number 1. This is how WordPress can go back to older versions of a post or page.

Unfortunately, this also adds to the size of the database. Eventually,  this will slow down the database. That’s why some of the performance plugins will clean out old versions. They are shrinking the database to make it faster.

The Purpose of the Files

The files in WordPress do a lot. In fact, WordPress wouldn’t know how to save or load a page if the files didn’t give instructions how.

The theme files also create the structure for the pages.  They build out the basic design of things like the headers, the footers , the sidebars and some of the page itself. 

To put it simply,  WordPress loads the files which pull together the pages and then the files load the content from the database and put it in the right format.

Finding Your Way Around WordPress

Of course, you don’t need any of this to use WordPress.  We get questions about this periodically and wanted to help folks understand it. Hopefully,  we’ve done that. What else do you need to know about WordPress?

Leave a Comment

Your email address will not be published.

Share via
Copy link
Powered by Social Snap