Get started with 33% off your first certification using code: 33OFFNEW

WordPress database tables explained

3 min read
Published on 11th December 2023

Blog Image


WordPress, at its core, is powered by a MySQL database. This database is the backbone of any WordPress site, storing everything from content to settings, users, and more. Understanding the structure and function of each table within the WordPress database can be invaluable, especially for troubleshooting, optimization, and custom development. Let’s break down and explore each table in the WordPress database.

wp_posts

The wp_posts table is one of the most significant tables in WordPress. It stores all types of content, including posts, pages, revisions, and custom post types. Key fields include ID, post_author, post_date, post_content, post_title, post_excerpt, post_status, and comment_count.

wp_postmeta

The wp_postmeta table stores additional information about posts stored in wp_posts. Each entry (or meta entry) is associated with a post and contains data like custom fields. Key fields include meta_id, post_id, meta_key, and meta_value.

wp_users

This table contains information about users, such as usernames, passwords (hashed), emails, and URLs. Key fields include ID, user_login, user_pass, user_nicename, user_email, user_url, and user_registered.

wp_usermeta

The wp_usermeta table stores additional user information in a key-value pair format. This includes user preferences and settings. Key fields include umeta_id, user_id, meta_key, and meta_value.

wp_comments

This table stores comments made on posts and pages. It includes details about the commenter and their comments. Key fields include comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date, comment_content, and comment_approved.

wp_commentmeta

Similar to wp_postmeta and wp_usermeta, the wp_commentmeta table stores additional information about comments. This could include custom fields added by plugins. Key fields are meta_id, comment_id, meta_key, and meta_value.

wp_terms

The wp_terms table is part of the taxonomy system in WordPress, which includes categories and tags. It stores the names and slugs of terms. Key fields are term_id, name, slug, and term_group.

wp_term_taxonomy

This table defines the taxonomy for entries in wp_terms. It specifies whether a term is a category, tag, or link category, and stores descriptions. Key fields include term_taxonomy_id, term_id, taxonomy, description, parent, and count.

wp_term_relationships

The wp_term_relationships table manages the relationships between WordPress posts and terms in wp_terms. For instance, it associates posts with their categories and tags. Key fields are object_id, term_taxonomy_id, and term_order.

wp_options

This crucial table stores site-wide settings, including site URL, admin email, default category, posts per page, time format, and more. Plugins also use this table to store settings and data. Key fields include option_id, option_name, option_value, and autoload.

wp_links (Deprecated)

Formerly used for blogroll features, the wp_links table is now deprecated but still exists for backward compatibility. It stored data related to links and link categories.

--

Each table in the WordPress database has a specific role, collectively ensuring the smooth functioning of your WordPress site. From storing content and user data to managing settings and relationships between posts and terms, understanding these tables is key for anyone delving deeper into WordPress’s inner workings.