WordPress Database Structure and Schema

A database will be created whenever you install a WordPress site. Everything on your WordPress website will be stored in this database.

WordPress website by default contains 12 tables.

WordPress database table relationship

  1. wp_posts
  2. wp_postmeta
  3. wp_options
  4. wp_users
  5. wp_usermeta
  6. wp_term_taxonomy
  7. wp_terms
  8. wp_term_relationships
  9. wp_links
  10. wp_comments
  11. wp_commentmeta
  12. wp_termmeta

wp_posts

wp posts

All content related to the WordPress website is stored in this table. Such as navigation menu, images, media files, and all attachments.

All plugins data is also stored in this table. This table also contains the text revisions and custom items.

wp_postmeta

wp post meta

Data about data is called metadata. wp_postmeta is extension of wp_posts. Some plugin data may also store in this table. Basically, it stores extra information from wp_posts.

wp_options

wp options

wp_options is the most important table of WordPress websites. It contains all administrative settings.

This table contains the website URL, titles, installed plugin & many more. The settings of plugins stores in this table also.

This table also stored the WordPress dashboard settings.

wp_options the table doesn’t share the relationship with other tables.

wp_users

wp users

All registered user information stores in this table. Such as like username, password, email, display name, and registration time of the users.

wp_usermeta

wp user meta

wp_usermeta is the extension of wp_users. This table store the extra information of the wp_users table.

wp_terms

wp_terms

wp_terms contain the categories for posts and pages. It also contains the tag(slugs) for the posts. Links related to categories are also stores in this table. This table has a relationship with wp_term_taxonomy and wp_term_relationships.

wp_term_taxonomy

wp_term_taxonomy

wp_term_taxonomy stores the description of categories, tags, and certain links associated with categories.

wp_term_relationships

wp_term_relationships

wp_term_relationships helps to maintain relationships. The wp_posts contains the post data. The wp_term_relationships table records the set category and tags.

wp_links

wp_links

wp_links contain the information about custom links added to your WordPress site. It has been deprecated and is not used any longer. Few older plugins still use. But usually, it is an empty table.

wp_comments

wp_comments

All comments (Approved and Unapproved) are stored in this table. This table also stores the information like author name, email, type of comment(whether it’s a simple comment and pingback/trackback).

wp_comment_meta

wp_commentmeta

Extra information about the comments like which posts and pages are associated with stored here.

wp_termmeta

wp_termmeta

wp_termmeta was introduced in WordPress 4.4. This table used to store additional info about terms. It is possible to access the term meta using the following function:

get_term-meta, add_term_meta, update_term_meta, and delete_term_meta.

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy