How WordPress saves your content

Introduction to phpMyAdmin

Want to learn more?

Transcript

When you build your WordPress site, write posts, or create pages, you constantly interact with the database. What does it mean, and how can you access this data? Let’s dive in.

Lesson objectives

  • Understand the difference between your site’s files and database
  • Explore your site’s database using the phpMyAdmin UI
  • Get a basic understanding of the structure and tables

What’s a database?

Almost all the content that you (and your visitors) create on a WordPress site is stored in a database. Posts, pages, comments, taxonomies, custom posts, theme customizations, and user details—none of these are standalone files. Instead, they are written to and read from a database that WordPress created during the installation.

Explaining how databases work is beyond the scope of this lesson, but it might be helpful to think of them as sophisticated spreadsheets; each table consists of columns and rows. Columns represent data keys, while rows represent the individual values.

For example, the table named wp_posts holds all your posts. Every detail of every post is listed as a row in this table, divided into columns that represent the relevant information: The post title is listed under the post_title column, the content is under post_content, and so forth.

Since the database is stored and managed along with all other files on your hosting provider’s server, you can access it, browse around, and even modify the data.

The database is perhaps the most critical part of your site, and you should only modify it if you have sufficient knowledge. Think of this lesson as a “look but don’t touch” introduction.

Access the database

To view your database, you need database management software. Most hosting companies offer a browser-based tool called phpMyAdmin, which we’ll use throughout this lesson. If you don’t have access to your host’s dashboard or prefer to explore the database via the WordPress Admin dashboard, use SQL Buddy (opens in a new tab), or another plugin such as Advanced Database Cleaner or WP phpMyAdmin. Don’t forget to deactivate and delete the plugin when you’re done to avoid potential problems.

From your hosting dashboard, open cPanel and select Databases > phpMyAdmin.

If your hosting company uses a different management platform, check the documentation resources to find out how to access phpMyAdmin.

Click on the database’s name on the left menu. What you see are all the tables that comprise your WordPress site.

If you have more than one database, and the name doesn’t give a hint to which site it belongs, visit the WordPress Admin dashboard:

  1. Navigate to Tools > Site Health.
  2. Click the Info tab, scroll down, and click on Database.
  3. Locate the line Database name and return to phpMyAdmin.

Exploring the tables

Let’s inspect two of the most important tables found in every WordPress database:

  • The wp_options table stores information about your site’s settings. Each row in the table represents a specific setting, including themes and plugins.
  • The wp_posts table stores your posts, pages, and custom post types. Each row in the table represents a single post.

wp_options

Click on wp_options and look at the two middle columns. The option_name column stores the keys (siteurl, blogname, blogdescription, admin_email, etc.) while the option_value column stores the respective value.

These correspond to the details you set in your Admin’s Settings > General screen: For example, siteurl is the web address that appears as WordPress Address (URL), blogdescription is the site Tagline, etc.

wp_posts

Now click on wp_posts. This table contains many more columns, yet each corresponds to a familiar UI element in the Post Editor. Here are a few examples:

  • The post_title column is where you’ll see the titles of all your posts.
  • The post_type column indicates if this is a post, page, or other type of content.
  • The guid stores the post URL.
  • The post_status indicates if it’s a draft or published.

Conclusion

As mentioned in the beginning, the database is a critical part of your site, and you should only modify it if you have sufficient knowledge. If you want to optimize, clean, or modify it—whether you use phpMyAdmin or a plugin—make sure you know what you’re doing and have a backup and recovery solution in place before you start.

To learn more, visit the Beginner WordPress Developer Learning Pathway, specifically the lesson titled, The WordPress database.

Practical

Use your own website or test website:

Access your database:

  • Log in to your hosting account and open cPanel.
  • Navigate to the Databases section and select phpMyAdmin.

Identify your WordPress database:

  • On the left menu, click on your database name.
  • If you have multiple databases, confirm the correct one by checking:
    • Go to your WordPress Admin dashboard.
    • Navigate to Tools > Site Health.
    • Click the Info tab and scroll down to find the ‘Database name.’

Explore the tables:

  • Take a moment to browse the tables listed in your WordPress database.
This is a preview lesson

Register or sign in to take this lesson.

Suggestions

Found a typo, grammar error or outdated screenshot? Contact us.