Where Are WordPress Pages Stored in Database? [SQL Lookup]

Do you know where WordPress pages get saved in the database? Basically, WordPress is made with PHP and MySQL, which is a top CMS. globally running more than 38% of websites, it has a 63% share in the CMS market.

Many of you like to use WordPress for your websites and you will find countless new as well as more advanced websites with WordPress. Even the blog you are reading right now, TheWPX, is on WordPress CMS. I have experience in WordPress, so I can share my expertise with you all.

Basically WordPress, which is a dynamic CMS made with PHP and MySQL, all your pages and posts are saved in SQL tables called “tmp0376b4_posts”. Considered as a smart way to manage your content instead of having separate HTMl files for every page, WordPress stores everything neatly in the table.

WordPress doesn’t create any individual HTML files for each post and page on your website. This makes it very convenient and makes the website easy and simpler to manage.

If you are new to WordPress, then understanding it may be a bit tricky. When I began my own website in 2015, using WordPress was a bit challenging. And if you are dealing with the same problem then don’t worry I will guide you.

Make sure you read this blog to the end to get a clear picture of how WordPress works and functions and where it keeps all your data.

Understanding How WordPress Works

The very first thing you need to understand is that your website is built using PHP and MySQL, because of this, you don’t need to keep separate HTML posts and pages you create.

When someone visits a page on your site, the content will be pulled from the database and is displayed on the webpage using PHP.

Just keep in mind that everything in the WordPress site is made on-the-fly and kept in the database. The header menus, footer content, sidebars, and your posts, all these are stored in the database and are fetched through PHP scripts as needed.

Ok, let me simplify this for you:

  • The user requests a specific page on your website built on WordPress.
  • WordPress will load the PHP function, starting with index.php.
  • Queries the database and requests the specific page or post your browser requested.
  • WordPress compiles the data with the plugins and theme and generates an HTML page for it.
  • And, the generated HTML page is sent to your browser for rendering.

Through this way, WordPress doesn’t need to store any individual pages for every page or post on your website, and it uses MySQL to generate the HTML pages for your user.

Where Are WordPress Pages Stored in SQL?

So, where are the pages you created stored in WordPress?

As you have read above, WordPress stores all the content or the pages you created in the database. All the posts and pages you created on your website are stored in a table “tmp0376b4_posts”.

If you have to modify the file manually or replace words using SQL, either use MySQL commands through SSH or can use tools like phpMyAdmin to access your server’s SQL database. phpMyAdmin is a powerful tool used for managing the database and the files within it.

phpMyAdmin will be likely on your hosting provider’s control panel. Basically, I use cPanel, so log in to my cPanel account and search for phpMyAdmin in the database section, as shown in the image below.

phpMyAdmin in cPanel

When you click on “phpMyAdmin,” you will be taken to a control panel. From there, you can manage your database and change it as you want. I’ll guide you through this process so you can manage everything smoothly.

If you are not too familiar with the “phpMyAdmin” panel, then don’t mess around with it because if something goes wrong then your whole website can become a waste and also there is no easy way to undo that.

It’s not a joke, trust me. I have dealt with this problem and that’s not very good.

Find the table named “tmp0376b4_posts” in SQL

When you go into the WordPress database, it will show you the tables that your website uses. In starting, WordPress starts with 12 tables as a default, but this can go up according to the theme or plugins you’ve added to your site.

You will find all the stuff related to pages, posts, and even the special content types in the “tmp0376b4_posts” table. Now, you might be wondering how this single table manages to keep different kinds of data for pages and other unique items, isn’t it?

Column named “post_type” inside “tmp0376b4_posts” in WordPress

There’s a part called “post_type” in the “tmp0376b4_posts” section and this is where you”ll get to see different kinds of content like pages, articles, and special types that WordPress and its extra tools use. So, basically this spot tells you what sort of items you are looking at whether it’s a regular page, post, or something unique.

In the picture, WordPress keeps various details in each column given there, from who wrote it to how many comments there are.

So, that’s how WordPress uses SQL to store pages and other important stuff.

How to Backup SQL Database of WordPress

You can backup your WordPress database via phpMyAdmin or with the help of WordPress backup plugins like Updraft or All in One Migration. The backing up process is not rocket science.

Now, let me explain to you how you can backup your database with phpMyAdmin, step by step. You can trust me as I have done it multiple times and know the ins and outs.

First of all, you need to login into your server’s control panel or cPanel. Once you are logged in, find and click on the phpMyAdmin option. It’ll take you to a page where you can see all your databases listed.

Once you have clicked on the phpMyAdmin option, pick the database you want to save. As an example, I’m using my “thewpx_wpx” database, that’s where I keep my dummy site’s data while I write these guides.

Exporting Database Using phpMyAdmin

So, once you are inside your database, click on the “Export” option displayed above your database files. The export page will open from where you can easily download a backup of your WordPress server. 

Exporting Database of Dummy Website

Once you are inside, you will see two ways to take your database out and the kind of file you want it to be in.

I have gone for the “Quick” way to pull out my database because it’s easy and covers all the things. Now, I have chosen the “SQL” file type because it’s good for keeping SQL databases.

At last, just press the “Go” button and your database will start to download on your pc.

So, follow these steps and you’ll have your backup ready in no time.

Important Files in WordPress & Directory Structure

In WordPress, there are some important files that help your website run without any problems. These include themes you are using and files for plugins that are added.

Now, let me share some more about WordPress files and how they are arranged. So, you can have a better idea how WordPress works.

Click in the “public_html” folder. This directory is where all the WordPress files that power the website live, just like the image below:

Files & Structure of WordPress

In WordPress, “wp-content” folder is like storage where you keep your media, files, themes, and plugins. This is where all the website’s uploaded pictures, the design theme you have chosen, and the extra features that you add through plugins are stored.

Now, the extra features (plugins) you use, in there, might be some folders. Now wait and remember, the “wp-content” along with the “wp-config.php” files are like the heart and brain of the WordPress site.

Just pay attention. Never ever think of deleting any files or folders you saw in that image, okay? Any mistake can mess up the website, making it totally unreachable.

Wrapping Up!

Concluding all of the above, WordPress stores your posts or pages in a database table called “tmp0376b4_posts”, and all other files like the templates and plugins, are stored in the “wp_content” folder. There’s no need to manually edit pages in the database or WordPress system files until and unless you are confident in your abilities.

Yet, if you want to make changes or customise anything, you can just use the theme customizer option to personalise your theme according to you. Also, you can edit your WordPress pages or posts by using Gutenberg Editor, Classic Editor, or a WordPress page builder.

So, that’s all for now. Hope you found this information helpful and if you liked it, then please share it with your friends, family, and your followers. If you have doubts regarding WordPress, its database, or file structure, just feel free to leave a comment below, and I”ll be very happy to help you and try to solve your doubts.

Sunny Kumar

Number of posts: 145

Hi, I'm Sunny Kumar, a passionate tech enthusiast and a blogger from New Delhi, India. With a degree in IT from IIT-D and expertise in SEO, Cloud Computing, Telecom & Networking, and CEH, I specialize in various technical fields, including SEO, WordPress Development, and PC Building. And being a proficient WordPress user, I’m dedicated to delivering quality content and a remarkable user experience.

Leave a Comment