As far as Content Management Systems (CMSs) go, none can boast the reputation, power, or flexibility of WordPress. It’s the most prominent CMS in the world today, so chances are you have a WordPress website too.

It has something for everyone, in no small part due to a vast plugin library. “There’s a plugin for that” is a phrase that’s as common in the community as it is true.

That said, mastering it may require that you work with its data. The average user likely won’t, and the WordPress dashboard will still suffice for all their needs. Some will want to go the extra mile, however, and working with data in WordPress does require some know-how.

If that’s the case for you, this article is here to help.

Understanding Data in WordPress

First things first, it’s important to understand just how data in WordPress works, how it’s structured, how connections are formed, and so on. Even if you have worked with databases or general web management before, this is a fundamental step.

To illustrate the importance of this step, WP Full Care strongly warns against tinkering with WordPress data without proper knowledge. The list of possible pitfalls is endless, from incorrect settings to data losses and more. So, before you get started, they suggest that you:

  • Have a firm grasp of WordPress data.
  • Start with a plan, and know exactly what changes you wish to make.
  • Back up your data at all times to be sure.

With this word of caution in mind, let’s begin.

The Components of WordPress Websites

Initially, all WordPress sites consisted of three components:

  • The WordPress installation itself. This will be the unzipped WordPress package as it is uploaded on your web server.
  • The wp-content directory. This will be the directory where themes, plugins, and uploads are included.
  • The WordPress database. This will be where all content is stored, such as posts and pages.

Among the three, you will likely never need to tinker with your WordPress installation itself. There are very few exceptions to this, like needing to create a .htaccess file if WordPress couldn’t due to permissions. But such issues, too, may be resolved right from the dashboard.

A screenshot of the traditional WordPress dashboard screen.

When one refers to “Data” in these contexts, the database – and its relation to wp-content – is typical of interest. So, exploring these is where understanding data in WordPress likely begins for most users.

Content Types

Now, to begin distinguishing “Content” from “data,” we can explain the different content types here. WordPress includes quite a few content types, including:

  • Posts – both regular and custom types
  • Pages
  • Attachments and links
  • Navigation menu items
  • Widgets
  • Options
  • Users
  • Third-party content
  • Hardcoded theme or plugin content
  • Sites, if you have a multisite installation

These content types then have data associated with them in the database, including:

  • Categories
  • Tags and post metadata
  • Custom taxonomies and terms

So, “Content” would be your basic content; pages, widgets, and what have you. “Data” would be data associated with content, such as categories and tags. If this feels in any way confusing, the next section should make it abundantly clear.

The WordPress Database and Its Structure

With the basic content/data relation in mind, you may imagine roughly what the database should look like. Well, there’s no need to guess; WordPress illustrates the database structure and table connections as follows:

An illustration of the WordPress database tables and their relationships.

So, before explaining how this works, a few things bear noting here. These fundamentals should make understanding data in WordPress, the structure, and the principles much easier.

  • Database tables opt for one-to-many relationships; say, a single user can have many posts. This directly saves space and makes working with data in WordPress all the easier.
  • The central table is wp_posts; it holds the majority of content and is linked to multiple tables via wp_users and wp_term_relationships.
  • The wp_options table is not linked to any tables, as it includes site and installation data.

The wp_links table is also largely standalone, but the Links feature has also been deprecated. You may only use this table if you restore the feature through WordPress’s own Link Manager plugin.

Now, each table contains its own data of note. Specifically, and in brief:

  • Wp_posts is the central table and includes posts, pages, attachments, and other central content data.
  • Wp_postmeta includes metadata for each individual post.
  • Wp_users is another central table and includes users. It naturally connects to wp_posts, as well as to wp_usermeta for user metadata and wp_comments for user comments.
  • Wp_usermeta includes user metadata.
  • Wp_comments includes comments.
  • Wp_commentmeta includes metadata for each comment.
  • Wp_terms includes categories and tags, as well as custom taxonomy terms. 
  • Wp_termsmeta includes term and taxonomy metadata.
  • Wp_term_taxonomy includes taxonomies, like categories and tags.
  • Wp_term_relationships includes the relationships between posts and taxonomies, linking wp_terms and wp_posts.
  • Wp_links includes links.
  • Wp_options includes site and installation settings and options.

If you’d like a deeper dive into each, WordPress’s Tables Overview should help.

Database Tables’ Contents

And finally, understanding data in WordPress hinges on grasping each table’s contents. Put differently, any change you want to make will require you to pinpoint exactly what you’re looking for.

Once you access your database, as we’ll cover next, you’ll see the tables in a form like the following:

A screenshot of a phpMyAdmin panel displaying the tables of a WordPress database.

As you can see above, table names give a decent hint of each table’s contents before you begin browsing. Thankfully, table columns continue this trend; for instance, if you want to edit anything related to comments, wp_comments is broken down into:

  • Comment_ID
  • Comment_post_ID
  • Comment_author
  • Comment_author_email
  • Comment_author_url
  • Comment_author_IP
  • Comment_date
  • Comment_date_gmt
  • Comment_content
  • Comment_karma
  • Comment_approved
  • Comment_agent
  • Comment_type
  • Comment_parent
  • User_id

So in this scenario, you’d need to start in wp_comments and locate the individual column(s) of interest.

Working With Data in WordPress

This should cover the basics of what WordPress data looks like. Now, let’s assume you want to actually start working with said data. To do so, you’ll need to access your database and start making calculated changes depending on your goals at hand.

So, let’s now see how this part of the process looks.

A Word of Caution

First and foremost, before you begin, we’ll repeat that you should keep a backup of your data at all times. Any number of mistakes could break your site, and many may be hard to reverse on your end.

For this purpose, you may use premium plugins or any dedicated WordPress backup plugin in the plugin repository, like:

A screenshot of the WordPress plugin library, displaying two results of a search on “backup” plugins.
  • UpdraftPlus – UpdraftPlus is available in both free and premium versions. It is one of the most popular backup plugins with over three million installs.
  • BackupBuddy – BackupBuddy is one of the popular premium WordPress plugins by iThemes. It is possible to take a backup of the entire WordPress website database and all WP files.
  • Jetpack Security – Jetpack Security is a premium security plugin with lots of security features and also includes backups.
  • WP Time Capsule – WP Time Capsule is a backup plugin that offers a 30-day full-featured trial. After that, different pricing plans are offered and you can choose which plan suits your website.
  • BackWPup – BackWPup offers both a free and premium version. With BackWPup you can backup a complete installation including /wp-content/ and save the backups externally on services like Dropbox, S3, etc.

If you prefer to back up manually, you can also do so. This process is rather lengthier than the few clicks plugins offer, however. 

Assuming your web hosting provider uses cPanel software, which most do, you’ll need to:

  • Login to your cPanel – this would be
  • Under Files, click on File Manager.
  • On the left panel, locate the folder named public_html; expand it by clicking on the + symbol, and select the folder with your website’s name.

If your website is large and/or you want to save time, you can right-click the folder and select Compress. From there, select Zip Archive and click Compress File(s). Once it’s complete, select the resulting .zip file and click Download on the top menu bar.

If you’re working with data in WordPress across different sites and want to migrate data for such reasons as website migration, note that you can skip this process altogether. Import-export plugins will remove most of the hassle for you in such cases – though those are not the focus of this article.

Accessing the WordPress Database

With your backups in order, you can now look into accessing your database to make your changes. To do so, most web hosting providers use cPanel and phpMyAdmin – so here we’ll assume yours does too.

Suppose your provider offers a non-standard management system, and you find the process differs substantially from the typical one outlined here. In that case, we suggest that you contact their support teams for details.

So, for this step, you will need to:

  • Log into your cPanel.
  • Under Databases, click on phpMyAdmin.
  • Enter your database username and password.

Following this process, you should find yourself on a screen mostly identical to this:

Working With Data in WordPress. A screenshot of a main phpMyAdmin panel.

Once you’re there, click on Databases at the top, and locate the folder with your website’s name. From this point, you’ll have access to your database – and the ability to modify it as you need.

Of course, each goal will need an entirely different course of action to achieve. This article can’t cover them all, but here it can outline an example to familiarize you with the process.

Example: Adding a New Admin User

A classic example of working with data in WordPress, you may want to add a new admin user for easier database management. For this goal, you’ll need to locate wp_users and click Browse.

From there, click on Insert on the menu at the top, and you’ll be presented with a form to fill out. The necessary fields to fill are:

  • User_login, which will be the user’s username.
  • User_pass, which will be the user’s password. Enter one of your choosing and select MD5 in the function column.
  • User_email, which will be the user’s email. 

You will also need to give user_registered a look and select the CURRENT_TIME in the function column.

From here, press Go to register your new user. This handles the user creation part but not the admin role part; you’ll need wp_usermeta for this. So first:

  • Go to wp_users and click Browse.
  • Locate your new user and note down their ID, as defined in the ID column.

From there:

  • Go to wp_usermeta and click Browse.
  • Click on Insert on the top menu.

Here, you’ll find a form assigning the admin role to your new user. The three fields to fill out here are:

  • User_id, where you’ll use the ID you noted down earlier.
  • Meta_key, where you need to enter wp_capabilities.
  • Meta_value, where you need to enter a:1:{s:13:”administrator”;s:1:”1″;}

So now your form should look like this:

A screenshot of a WordPress database form displaying fields necessary to grant a user admin status. Understanding data in WordPress.

Click Go once you’re done, and now there’s only one more step. Return to wp_usermeta, click on Insert to add another row, and fill in the form’s following fields:

  • User_id, where you’ll enter your new user’s ID.
  • Meta_key, where you’ll need to enter wp_user_level.
  • Meta_value, where you’ll need to enter 10 as the user-level value.

Click Go once again, and you’re done.

Summing Up

To conclude, understanding data in WordPress and working with data in WordPress may seem daunting to new users – never mind working with it. But every new endeavor seems hard initially, which shouldn’t discourage you.

As we’ve seen, WordPress data is quite logically structured and easy enough to understand if you put in the effort. If the WordPress dashboard doesn’t suffice for your needs, learning to work with data and understanding data in WordPress can be equal parts productive and fulfilling.

Just remember to back up your website before getting started, to repeat that word of caution one final time. Many mistakes are possible – especially if you’re new to database management; it’s better to be safe than sorry.

Author Bio

Daniel Newstead is a freelance copywriter, avid SEO practitioner, and WordPress enthusiast. He writes on all things digital marketing and frequently contributes content to businesses in the moving and AEC industries.

Disclosure: We sometimes use affiliate links in our content. Some of the links in this post are “affiliate links.” It means if you click on the link and purchase the item, we will receive an affiliate commission. It helps our website keep on running and allows us to offset our writing team’s cost. Thanks for your support.

About the Author

WP Webify

WP Webify

Editorial Staff at WP Webify is a team of WordPress experts led by Peter Nilsson. Peter Nilsson is the founder of WP Webify. He is a big fan of WordPress and loves to write about WordPress.

View All Articles