Have you ever wondered where WordPress stores A post is a type of content in WordPress, a popular open-source content management system used for creating an... More and In WordPress, a page is a content type that is used to create non-dynamic pages on a website. Pages are typica... More? It’s a bit counterintuitive, especially if you’re not familiar with how WordPress works.
WordPress stores the content of your posts and pages in the
wp_posts table of your A database is an organized collection of data stored and accessed electronically. It is a crucial component of... More. Because WordPress uses dynamic PHP templates to display your content, it does not store an individual HTML file for each page on your site.
Again, this may be confusing if you’re just starting to learn the ins and outs of WordPress. Don’t worry—in this article, you’ll learn exactly how WordPress stores your posts and pages and displays them on your site.
Understanding How WordPress Works
The first thing to understand about how WordPress stores posts and pages is that WordPress is written in PHP, not HTML.
Every time you visit a WordPress site, it loads a set of PHP scripts that query the database for the required content, and it uses that content to build out an HTML page on the fly, before sending that page to your browser.
This allows WordPress to compile dynamic content from multiple sources—your header, your sidebar, your page content, and your footer, for example—into one cohesive page.
To simplify things, here’s what happens when someone visits your WordPress site:
- The visitor’s browser requests a specific page
- WordPress loads the necessary PHP scrips, starting with index.php
- WordPress queries the database and retrieves the data for the requested post or page
- WordPress compiles the page/post data with the data from your active plugins and A WordPress theme is a set of files that determine the design and layout of a website. It controls everything ... More and generates an HTML web page
- That dynamically-generated HTML page is sent to the visitor’s browser
This happens with every page on a WordPress site. It’s all generated dynamically, so you won’t find your HTML page content in your file system.
See also: How Does WordPress Store Data?
Where WordPress Stores Posts And Pages In The Database
WordPress stores the content of your posts and pages in the
wp_posts table of your database.
If you want to view or modify this data, you’ll need to use a tool like phpMyAdmin. On most web hosts, you can do this by logging into cPanel (or your host’s control panel) and locating the phpMyAdmin icon:
Note: You should not attempt to edit your database unless you know what you’re doing. In the vast majority of cases, there is no reason to edit your page/post data outside of the In WordPress, the Dashboard is a central hub for managing a website's content and settings. It is the first sc... More.
After opening phpMyAdmin, you’ll want to select the name of your database in the left sidebar:
If you installed WordPress with an autoinstaller, this will probably look something like
account_wp20. Look for the “wp” for WordPress.
After selecting your database, you’ll see a list of database tables:
Click on the one titled
You’ll then see a list of content items on your WordPress site, from attachments to posts, pages, revisions, and more:
Each column in the table contains a certain type of metadata for each item. For example, there are columns for the post title, post content, In WordPress, an excerpt is a summary or brief description of a post's content. It is typically used to provid... More, post status, comment status, and so on.
Most likely, this table contains a LOT of stuff that you’re not looking for. If you’re looking for a specific type of content, e.g. posts or pages, you can sort the table by the
post_type column. You can also use the search bar to search for the word “page,” for example.
There it is! This is where WordPress stores your posts and pages.
From here, you can easily edit any of the items to manage the content or metadata of a given post or page as needed.
Backing Up Your Database
Keeping regular backups is a key component of good WordPress security. Before making changes to your WordPress database, you should always create a backup.
Ideally, you’ll have an automatic backup solution in place for your entire site, but you can also export a copy of the database directly through phpMyAdmin.
You can do this by clicking the “Export” tab at the top:
From here, simply follow the prompts to download a
.sql export file of your database.
In the event that something goes wrong, you can restore your backup later using the “Import” tab.
Where To Find Your Theme’s Page And Post Templates
WordPress stores the content and metadata of your posts and pages in the database, and that data is dynamically merged into your current theme’s PHP templates, which you can find in your file system.
You can use an FTP client like FileZilla or your cPanel file manager to access your site files.
New to FTP? Check out our full WordPress FTP tutorial here. 👈
From your site’s root directory, navigate to
your-theme with your currently active theme.
Within this directory,
single.php is your single post template, while
page.php is your page template.
If you know what you’re doing, you can edit these files to change the way WordPress formats your content. (It’s a good idea to use a child theme to ensure your changes aren’t overwritten by a future theme update.)
Keep in mind that these files do not contain the content of your individual posts or pages—they simply format the web pages, query the database, and tell WordPress how and where the content should be displayed.
In summary, the content of your posts and pages are stored in the
wp_posts table of your database, while your post and page templates are stored in your file system at
There’s generally no reason to edit your posts and pages from the database, as the WordPress dashboard handles this quite well. However, if you’re having trouble editing some particular metadata in the WordPress admin area, going directly to the database can be a surefire fix.
If you have any questions about your WordPress database or file structure, please feel free to leave a comment below!