Where Are WordPress Pages Stored? [SQL Lookup]

WordPress is a content management system that is programmed in PHP and MySQL. Starting from the very basic blogs to the most sophisticated websites, WordPress functions very well for different purposes.

Nowadays, almost 32% of online websites are built with WordPress. It’s the most reliable and successful platform to manage your website content.

WordPress uses templates to display information. And it stores the information in respective database tables. The WordPress code recalls this data to display on a given template.

WordPress File & Directory Structure:

wordpress-files

Most users are using WordPress without even knowing enough information on how their data are being processed or stored. Understanding this process will help you resolve many common WordPress issues on your own!

Usually, the content pages are using theme files like; page.php for pages and single.php for blog posts. There may be additional custom posts that the template defines and arrange.

But for the information, text, images, embeds, etc, they’re stored in a database (MySQL DB). Thus, you will not be able to access your website content via files. Instead, you will have to look up the MYSQL database.

Where Are WordPress Pages Stored in MySQL?

Beginners might wonder about where the WordPress pages are stored? Well, Pages and Posts content is being stored directly in the MySQL database.

You can directly find posts content under the “wp_posts” table in the database. But how about the pages? Is there a table called “wp_pages”? That’s not correct!

The “wp_posts” table includes all post types (post, page, custom post, ..etc). And in order to differentiate between them, there is a table field called “post_type” used to specify the name of the current entry whether it’s a page, post or a custom post.

Access WordPress pages using PHPMyAdmin:

Now that you’ve got to know where the pages are stored in the MySQL database, it’s time to learn how to access them directly in SQL DB.

In this tutorial, we will use PHPMyAdmin that comes integrated with each cPanel shared hosting account. Check the screenshot below for more information:

PHPMyAdmin cPanel Access

In PHPMyAdmin, you will need to choose the database name for your WordPress installation. In there, you can choose the sub-table “wp_posts” as we’ve mentioned.

You’ll need to click the corresponding “Browse” link as follows:

wp_posts_phpmyadmin

Here, you will be able to find all the stored content for (Posts, Pages, or any custom posts available). This is the table that content is stored on your database for Pages as well.

There’s a field called “post_type”. This will definitely help you to find the entries that are pages or posts based on the given type for that field.

Please see the screenshot below for more information:

attachment-posttype

Now all these entries with the post_type page are your WordPress website actual pages content. Find out the page you would like to edit and you can simply hit “Edit” link for a direct content or code edit via PHPMyAdmin.

Conclusion:

That was it all about how pages are stored on WordPress using MySQL PHPMyAdmin. The steps above are pretty easy and straight forward.

Do not forget to share this article with those who may find it useful. Follow the steps mentioned and let us know in comments for any inquiries or assistance.

2 thoughts on “Where Are WordPress Pages Stored? [SQL Lookup]”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.