Ever wondered where does WordPress save pages? Well, this is something non-intuitive especially if you are new to WordPress and don’t know how it works. Do not worry as this article will help you know how WordPress stores and saves pages and displays them on your website. Also, have a look at Popular WordPress Themes by VWThemes.
Know How WordPress Works
In Where Does WordPress Save Pages, The first thing you need to know is that WordPress is written in PHP and not HTML. so when you visit a WordPress site, it loads PHP scripts that query the database for the desired content and that content is used for building out an HTML page on the fly before that page is sent to your browser. This enables WordPress to compile dynamic content from multiple sources such as your header, your sidebar, your page content, your footer, etc into one cohesive page.
That is exactly what happens when someone visits your WordPress website:
- visitor’s browser requests for a specific page
- WP loads the needed PHP scripts beginning with index.php
- WordPress then queries the database and it retrieves the data for the specific requested post or page
- The page/post data from your active plugins and themes is then compiled by WordPress and it generates an HTML webpage.
- This HTML page is then sent to the visitor’s browser.
Every page on a WP site undergoes this and as it is generated dynamically, you won’t find your HTML page content in your file system.
Where Does WordPress Save Pages In The Database?
The content of your posts and pages is stored in the wp_posts table of your database by WordPress. For viewing and modifying this data, you will need to use a tool such as phpMyAdmin. You can do this by logging into cPanel on most of the web hosts and locating the phpMyAdmin icon:
Once you open phpMyAdmin, you will need to select the name of your database on the left sidebar:
In case you have installed WordPress using an auto-installer, it will possibly look like account_wp20. See that ‘wp’ for WordPress. Upon selecting the database, you will see a list of database tables:
Click the one titled ‘wp_posts’.
Then you will see a list of content items on your WordPress site including attachments to posts, pages, revisions, etc.
Every single column in the table has a certain type of metadata for every item. Just, for example, there are columns present for the post title, post content, post status, comment status, etc.
This table mostly contains a lot of stuff that you don’t need or not looking for. If you are looking for posts/pages, you can sort the table by post_type column. You may also make use of the search bar for searching the word ‘page’, for example.
Here it is! It is here where WP stores your pages and posts.
From here, editing any of the items becomes easy for you for managing the content or metadata for a given page/post as needed.
Taking a Backup of Your Database
Regular backup is a good practice for WordPress security. So before you make changes in the WordPress database, you should always take a backup. Ideally, an automatic backup solution in place for your entire site is what you have. But, you will be also able to export a copy of the database directly through phpMyAdmin.
This can be done by clicking the ‘Export’ tab at the top:
Now, from here, just follow what is prompted for downloading a .sql export file of your database. If something goes wrong, you can always restore the backup by using the ‘Import’ tab.
Where To Find Your Theme’s Page And Post Templates
The content and metadata of your posts and pages are stored by WordPress in the database and that data is dynamically merged into your present theme’s PHP templates which you can see in your file system.
You will be able to use an FTP client such as FileZilla or your cPanel file manager for accessing your site files.
From the root directory of your site, go to:
/wp-content/themes/your-theme/, replace your-theme with your presently active theme.
In this directory, the single.php is your single post template whereas page.php is your page template.
You can also edit these files for changing the way WordPress formats your content ( I would recommend doing this only if you know what you are doing. It is always better to use a child theme for ensuring that changes aren’t overwritten by any future updates.)
In Where Does WordPress Save Pages, Do keep in mind that these files do not have the content of your individual pages or posts. They just format the web pages, query the database, and direct WordPress to how & where the content needs to e shown or displayed.
Conclusion
We have seen so far that your pages are saved in the wp_posts table of your database whereas the post and page templates get stored in the file system at wp-content/themes/your-theme/. As wordPress dashboard gives you all the resources for making changes in your pots and pages. There is no need to edit them from the database. We hope you have found an answer to where does WordPress save pages in this article.
WordPress Theme Bundle
In order to make good websites, you need good WordPress themes as well. Things get more time-consuming if you are a developer that needs to work on several website projects. For that, a WordPress theme bundle is an easy solution. VWThemes offer an amazing WordPress bundle of All Themes that contain intricately crafted themes having easy-to-customize design, responsive layout, and visually appealing looks. This entire bundle is available at greatly discounted prices which makes it a deal that you cannot miss.