Where Are WordPress Posts And Pages Stored?

By James LePage
 on March 17, 2022

Where Are WordPress Posts And Pages Stored?

By James LePage
 on March 17, 2022

A common question that many WordPress users have is "where are pages and posts stored"? In this article we are going to review how WordPress manages and stores content.

Compared to static websites that store contact as HTML files, WordPress is a dynamic CMS based on PHP. It does not store posts as files, but instead as database entries. Content for posts and pages are stored on a MySQL-based database in the wp_posts table, is dynamically inserted into PHP templates, rendered, and served to the website visitor.

PHP Myadmin
Does the first entry look familiar? Keep reading to learn more.

So what exactly does this mean? Let's dive in.

WordPress is not built in HTML. Instead, it uses PHP to dynamically render content, combining header, footers, and various other templates into a single cohesive page. When a user requests a webpage, the page is generated on the fly, and then served to that visitor.

Here's the server-side process that occurs when pages are created:

  • The users browser request a specific page
  • Depending on the content type and additional parameters, PHP scripts and templates are loaded
  • This is the structure of the data will dynamically populate
  • WordPress queries it's database for the specific post being requested, pulling in information like the content, featured image url, and more
  • This data is inserted into the page via PHP, and compiled into HTML
  • The final HTML webpage is sent to the visitor for their viewing pleasure
How PHP Works to make a page
The general process (source)

This is why you can easily make changes in the WordPress user interface, and they are immediately reflected on the front end of the website. It's completely dynamic!

As a side note, many websites use a technique called caching, which means that a pre-rendered HTML file is generated every couple of hours (instead of on the fly), and served to visitors, minimizing time to first bite and increasing the page speed. It's the perfect mix between static speed and dynamic rendering.

The page generation process mentioned above shows where the "data" for posts and pages are stored.

If you're looking for the content of an individual post or page, it'll be in the database. If you're looking for the structure of that said post or page (what the data populates into), that'll be a PHP file.

Where WordPress Posts and Pages are Stored?

Content for posts and pages are stored on a MySQL-based database in the wp_posts table.

MySQL Phpmyadmin wp_posts table structure
The structure of the data in the wp_posts table. You'll notice a title cell, content, author and more.

Technically, you can make edits to your posts directly in the database. However, there's no reason to do this in most situations. WordPress exists to make it easy for people to visually change content via an admin dashboard. That is the power of a content management system.

But, let's say that you want to view the database entry for a specific post. If this is the case, you'll use a tool like PHPMyAdmin (or any other database management tool). PHPMyAdmin is the most common tool that you'll come across, and it's installed and all cPanel based hosting.

Access php myadmin

In the database manager, there are a collection of tables that store and organize every facet of dynamic data associated with the WordPress website. For example, in addition to pages and posts, users, general settings, and other information is stored here. Virtually every piece of information in this database can also be edited from the WordPress admin user interface.

The wp_posts database table is a vast collection of all of your posts and pages. Each row is an individual piece of content on your WordPress website. It is where WordPress individual pages and posts are stored.

The layout of the table is relatively self-explanatory.

Table headers

Each column contains specific meta-data such as the date of publication, the date of revision, the title, the general contact, an excerpt, and any additional fields that may be associated with that post

If you really wanted to edit a post via PHPMyAdmin, you can (we do not recommend this). Simply double click the table cell that you'd like to edit, and change the data. This is similar to changing data from the admin dashboard, and clicking "update", but comes with many drawbacks such as no revision history.

Because all your WordPress pages and posts are stored in a database, they can be easily exported for use and another WordPress installation.

The beauty about WordPress is that regardless of the front and design, the structure of the data never changes. You can also apply these concepts to website maintenance and security, regularly backing up your database and WordPress content within by exporting an SQL file every once in a while.

However, in practice we recommend using an automated backup service or plugin, as the database only contains text content. Media items are referenced within this database, but the actual file directories that they're hosted in or not exported or included in the database.

Compared to other websites implementations that may use HTML templates, a WordPress database export is a lot lighter as it is simply text categorized into rows and columns.

While this is the main answer to the question of this post, you may also be wondering where the actual PHP template that defines the structure that this data populates into is stored. In fact, the template is the other side of the coin in regards to where WordPress pages and posts are stored.

Where WordPress Templates are Stored?

WordPress page and post templates, which defined the structure that the dynamic data from the database will populate into, are managed by your active WordPress theme.

PHP Templates

WordPress themes may also have the functionality of being able to switch between multiple templates for specific page and post types. The data remains the same, and is pulled from the database, but the page structure changes as the PHP template utilized to render the HTML can be switched out depending on user preference.

In 2024, things also may be taken a step further. If you're using a page builder, they typically render contents out through shortcodes. Many builders still utilize the theme system, but overlay their own templates on top of blank WordPress page PHP templates. This topic in itself is another post for another day.

We hope this article provided a good summary of where WordPress pages and posts are stored. To recap, the data is stored in your MySQL database, under the WP_posts table, where is the actual structure of the page is dictated by PHP file within your theme, and can be found in your web hosting directory.

If you have any additional questions don't hesitate to reach out in the comments section below, we are always happy to help!

Subscribe & Share
If you liked this content, subscribe for our monthly roundup of WordPress news, website inspiration, exclusive deals and interesting articles.
Unsubscribe at any time. We do not spam and will never sell or share your email.
Notify of
Inline Feedbacks
View all comments
Article By
James LePage
James LePage is the founder of Isotropic, a WordPress education company and digital agency. He is also the founder of, a venture backed startup bringing AI to WordPress creators.
We're looking for new authors. Explore Isotropic Jobs.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram