Where Are WordPress Posts And Pages Stored? [SQL Lookup]

where wordpress pages are stored, where wordpress pages stored, wordpress page location in sql database, wordpress pages

In 2024, WordPress powers over 35% of the internet, a 2% increase from early 2019, and these numbers continue to grow each day. The reasons behind its popularity are stable performance, fast loading speed, security, and an easy-to-use interface.

If you’ve recently started using WordPress, you might be wondering where it stores posts and pages. If you think WordPress creates and stores individual HTML files for each post and page you publish, you’re mistaken.

Now, the question arises: if WordPress doesn’t create separate files for each post and page, then how does the entire system work? Where does WordPress store posts and pages?

WordPress stores your post and pages’ content in the “<strong>wp-posts</strong>” table of the database and displays your website’s content with dynamic PHP templates. When you publish a new post or page, WordPress adds the entry in a database table.

When requested, the WordPress code recalls the data from a database table to display. Now, after hearing the word “Database,” you may be confused. Don’t worry, below I have explained everything you need to know. Read the post carefully.

Understanding How WordPress Works

First, it is essential to clarify that WordPress is written in PHP, not as HTML, and it uses MySQL for the database. WordPress does not store a single page or post as an HTML document. When you publish any new post or page, it just adds an entry to a database table.

When someone opens the website, the browser requests the server for the files; WordPress PHP scripts gather the data from the MySQL database and present content in front of the visitor.

where wordpress pages are stored, where wordpress pages stored, wordpress page location in sql database, wordpress pages
How WordPress Works

Not just posts or pages, everything in WordPress is created dynamically and stored in the database, including the header menus, the footer contents, the sidebars, and the posts.

Here is how everything works in simple words;

  • The visitor, who is known as the client, enters the website address in the browser, and then the browser requests the server for the files using DNS.
  • When WordPress PHP scripts are requested, it starts loading the files, beginning with index.php.
  • It recalls the browser-requested data from the database.
  • Then, the WordPress PHP scripts work together and compile the data with plugins and themes to generate the HTML page.
  • The page will be generated dynamically and sent to the browser for rendering.

This is how the complete system works. They store no files in HTML, and all files are generated automatically using PHP after getting data from the database.

Where Are WordPress Posts Stored in SQL?

Now, you may question if everything is stored in a database, where precisely the posts are stored. The answer is that all the posts are stored in the table named “tmp317e7a_posts.

It is also possible to modify the posts manually by editing the database. You can edit your website’s SQL database with the help of an SSH command or the tools like PHPMyAdmin. PHPMyAdmin is one of the most used, easy-to-use tools that allows you to manage the database and the files inside it entirely.

You can easily open PHPMyAdmin from the control panel of your hosting. If your website is hosted on VPS, then you have to check whether the PHPMyAdmin is installed on your server or not. In my case, my website is hosted with cPanel.

where wordpress pages are stored, where wordpress pages stored, wordpress page location in sql database, wordpress pages

First of all, log in to your Webhosting account (cPanel) and search for PHPMyAdmin. You will get it in the database section, as shown in the image.

Click on PHPMyAdmin. You will be redirected to its dashboard. From here, you can completely manage your database and modify it according to your needs.

I recommend you not to make changes in the database if you are not a developer or familiar with it. It will break your website. And even in some conditions, it is not possible to recover the database. You can fully customize your website from the front end by using a theme customizer.

You will see all the databases in PHPMyAdmin. First, you have to rectify that which is the database of the particular website you want to make changes to. If there is a single website hosted, then you don’t have to worry about it.

Find the table named “tmp317e7a_posts” in SQL
Find the table named “tmp317e7a_posts” in SQL

Click on the database to open. It will start showing you the tables on the right side. Generally, there are 12 tables, but the number can be increased depending upon which theme or plugins you are using.

Here you will get the table named “tmp317e7a_posts,” which stores all the content of posts, pages, and custom post types. The table is called “tmp317e7a_posts,” but it also stores pages and custom post types.

Column named “post_type” inside “tmp317e7a_posts” in WordPress
Column named “post_type” inside “tmp317e7a_posts” in WordPress

Well, you will get the column named “post_type” in the “tmp317e7a_posts “database table, which includes all the post types, such as post, page, and custom post. The field specifies that the content is a page, post, or a custom post.

All the other tables and columns in the database store different types of information like author names, total comment counts, and social share information if you are using any plugin. That’s how the complete system works.

How To Backup SQL Database of WordPress?

It is imperative to take a backup of the entire database if you are going to make any changes. And even if you are changing the host, you can backup the SQL database from your current host and restore it to a new one.

You can back up a database in two different ways. First, by using WordPress backup plugins like Updraft and All in One Migration. And you can also take the backup manually from the server side.

You are reading this article, which means, most probably, you are going to edit the database manually. That’s why below, I have shared the manual way to backup the database. It is also the easiest way to backup.

To backup the database, you need to login into your Cpanel, then find and click on the PHPMyAdmin option, you will get it in the database section. It will redirect you to the PHPMyAdmin control panel.

Exporting Database Using phpMyAdmin
Exporting Database Using phpMyAdmin

On the left side, you will see the list of all the available databases and click on the one you want to backup. Here is my case, I am going to back up the “thewpx_wpx” named database.

Now the database will open in front of you. On the top, you will get the option as Export, click on it. From the export option, you can export your database in one click.

Exporting Database of Dummy Website
Exporting Database of Dummy Website

Choose the desired option. I highly recommend choosing the “Quick” method as it backups the entire database and selects SQL as the file format. SQL format is the most efficient format to store the database. Click on Go, and the downloading of that database will start.

Important Files in WordPress & Directory Structure

WordPress is not just about the database; there are a few more essential files responsible for running your website flawlessly. Those files contain all the settings, the plugin you are using on your website, and the theme you have activated.

Here I’m sharing more information about the files and directory structure of WordPress. This information will help you understand how WordPress works.

To see those files, log in to your hosting control panel, here I am using cPanel. Go to the File Manager option, and you will be redirected to your website’s file system.

Files & Structure of WordPress
Files & Structure of WordPress

Click on the folder where you have installed WordPress for a particular website. It is a “public_html” folder if there is only one website hosted on your server. This folder contains all the website files.

All those files are essential to run your website. In the “wp-content” folder, there are 3 subfolders named “uploads, “”themes, “and the “plugins,” in which all the data of your plugin, theme, and the media you have uploaded is stored.

You will also see a few more folders here, depending on the plugin you’re using. The files named “wp-content” and “wp-config.php” are the website’s most important files. Those two files are responsible for all the functions.

It is highly recommended not to edit or delete any of those files or folders. Any change may break your website.

Wrapping Up!

I hope you get what you are looking for. WordPress pages are stored in the database, not as HTML files. WordPress PHP scripts recall the data from the database and present it by generating the HTML file when requested by the visitor.

If you are just a normal WordPress user, then there is no need to open and customize the database in any condition. You can do all the customization from the WordPress admin dashboard itself. Even now, you can present your content more engagingly with the help of the new Gutenberg Editor.

Gutenberg Editor is the new drag-and-drop editor by WordPress. It allows you to customize the page as you want fully and works like a visual page builder Elementor.

Please do share this article with your friends and family if it is helpful to you in any manner. If you still have any questions, you are free to ask in the comment section below.

Avatar of Sunny Kumar
Sunny Kumar
Hello! I’m Sunny Kumar from New Delhi, India, a tech enthusiast and blogger with an IT degree from IIT-D. My expertise lies in SEO, Cloud Computing, Telecom & Networking, and CEH. I specialize in SEO, WordPress Development, and PC Building. And being a proficient WordPress user, I’m dedicated to delivering quality content and a remarkable user experience.

6 thoughts on “Where Are WordPress Posts And Pages Stored? [SQL Lookup]”

  1. This article tells you detailed information on WordPress SQL lookup and keeps sharing similar topic.
    Thanks, for sharing this article

    Reply
  2. I was looking for such kind of information and this is a very nice written blog. I’m getting a lot of good information. Thank you.

    Reply
  3. Thank you for this informative post, it clears up a lot of confusion about where WordPress stores posts and pages. I appreciate the detailed explanation about how the WordPress system work along with SQL database!

    Reply
  4. I must say, this comprehensive guide really helped in understanding WordPress storage. The way you clarified WordPress’ workings, from database usage to PHP scripts dynamics is simply impressive. Now, I can optimise my site better. Thanks!

    Reply

Leave a Comment