WordPress

What Are the Different Types of WordPress Default Tables?

WordPress creates 12 default database tables, plus 6 on multisite. What each holds, its indexes, where bloat comes from and how to clean it safely.

Shashank Dubey
·13 min read
Grid of the 12 default WordPress database tables with wp_posts, wp_postmeta and wp_options highlighted

A fresh single-site WordPress install creates 12 default tables: wp_posts, wp_postmeta, wp_comments, wp_commentmeta, wp_terms, wp_term_taxonomy, wp_term_relationships, wp_termmeta, wp_options, wp_links, wp_users and wp_usermeta. Multisite adds six network tables on top, and every extra site gets its own copy of ten of the twelve.

The old version of this post listed ten tables and missed two (wp_commentmeta and wp_termmeta). We rewrote it against the WordPress core schema file and a live install. Anything not on these lists, such as WooCommerce order tables or Action Scheduler tables, was added by a plugin and is not a default table.

Checked on 15 November 2026 against wp-admin/includes/schema.php in WordPress trunk (the 7.2 development branch) and the 7.1 and 7.0 branches. All three declare the same tables and indexes. We also ran the table list and every query below on a WordPress 7.1.4 test site.

Which tables does WordPress create by default?

The table list lives in one place: the wp_get_db_schema() function in wp-admin/includes/schema.php. The developer handbook page on the Database API points you to the Options, Transients and Metadata APIs but does not enumerate tables, so the schema file is the authority. The class that registers the names is wpdb, whose $tables, $global_tables and $ms_global_tables properties hold the lists.

Table

What it holds

Primary key

Other indexes

wp_posts

Posts, pages, attachments, revisions, menu items and every custom post type

ID

post_name, type_status_date (post_type, post_status, post_date, ID), post_parent, post_author, type_status_author

wp_postmeta

Key/value data attached to a post

meta_id

post_id, meta_key

wp_comments

Comments, pingbacks and trackbacks

comment_ID

comment_post_ID, comment_approved_date_gmt, comment_date_gmt, comment_parent, comment_author_email

wp_commentmeta

Key/value data attached to a comment

meta_id

comment_id, meta_key

wp_terms

The name and slug of each category, tag or custom term

term_id

slug, name

wp_term_taxonomy

Which taxonomy a term belongs to, its parent and its post count

term_taxonomy_id

unique term_id_taxonomy (term_id, taxonomy), taxonomy

wp_term_relationships

Links between posts (or links) and terms

object_id + term_taxonomy_id

term_taxonomy_id

wp_termmeta

Key/value data attached to a term

meta_id

term_id, meta_key

wp_options

Site settings, plugin settings, cron schedule, transients

option_id

unique option_name, autoload

wp_links

Blogroll links from the legacy Link Manager

link_id

link_visible

wp_users

One row per account: login, hashed password, email

ID

user_login_key, user_nicename, user_email

wp_usermeta

Key/value data attached to a user, including roles

umeta_id

user_id, meta_key

The meta_key indexes are prefix indexes limited to the first 191 characters, a leftover of the move to utf8mb4 in WordPress 4.2. The prefix wp_ is only the default. The real prefix is whatever $table_prefix says in wp-config.php, so replace it in every query on this page if yours differs.

What does each default table store?

wp_posts: content of every kind

Despite the name, this table is not only for blog posts. Pages, media library items, navigation menu entries, revisions, and in block themes the templates, template parts, global styles and navigation menus are all rows here, told apart by the post_type column. Cached oEmbed responses are stored here too, as the oembed_cache type.

The columns you will touch most are post_title, post_content, post_excerpt, post_status (publish, draft, auto-draft, inherit, trash and so on), post_name (the slug), post_parent (a revision points at its post, an attachment at the post it was uploaded to), post_type and the two date pairs, local and GMT. The composite type_status_date index is what makes the usual “latest published posts” query fast, because it matches the order of its WHERE and ORDER BY.

wp_postmeta: where plugins put their data

One row per (post, key, value). Core uses it for the featured image (_thumbnail_id), the uploaded file path (_wp_attached_file), image sizes (_wp_attachment_metadata), the page template and edit locks. Page builders, SEO plugins and WooCommerce product data add far more. A key can legitimately appear several times for the same post, so “duplicate” rows are not always junk.

On most large sites this is the biggest table after wp_posts, because every plugin that stores per-post settings multiplies its rows by your post count.

wp_comments and wp_commentmeta

wp_comments holds the author name, email, IP address, content, the comment_approved state (1, 0, spam or trash), comment_type and the comment_parent used for threading. The comment_approved_date_gmt composite index covers queries that filter by approval state and date. wp_commentmeta carries extras such as Akismet’s check results.

wp_terms, wp_term_taxonomy, wp_term_relationships and wp_termmeta

Categories and tags are split across three tables on purpose. wp_terms stores only the name and slug. wp_term_taxonomy says what kind of thing that term is (category, post_tag, a custom taxonomy), who its parent is, and how many objects use it (count). wp_term_relationships joins an object, usually a post ID, to a term_taxonomy_id. The same name can therefore exist as both a category and a tag without clashing.

wp_termmeta was added in WordPress 4.4 for per-term metadata. It is the table the old version of this post forgot.

wp_options: settings, and the table most likely to slow you down

Every row is a name and a value, and the autoload column decides whether WordPress reads that row into memory at the start of every request. Core keeps siteurl, home, blogname, active_plugins, rewrite_rules, the cron schedule and wp_user_roles here. Plugins and themes store their settings here as well, and so do transients when no persistent object cache is installed.

Since WordPress 6.6 the autoload column accepts on, off, auto, auto-on and auto-off alongside the legacy yes and no. The schema default is still yes. Core loads rows whose value is in wp_autoload_values_to_autoload(): yes, on, auto-on and auto. This matters for cleanup, because a query that only looks for autoload = 'yes' undercounts on a modern site. The core announcement also describes the 150,000-byte threshold above which new options are not autoloaded unless the caller asks for it, and the Site Health warning that appears once autoloaded data passes 800 KB.

wp_users and wp_usermeta

wp_users holds user_login, user_pass (a hash, never the password), user_nicename, user_email, user_registered, user_activation_key (used by password resets), user_status and display_name. wp_usermeta holds everything else: first and last name, the role in a key named wp_capabilities, dashboard preferences and login session tokens. Changing the table prefix therefore means renaming those prefixed keys inside wp_usermeta and wp_options, not only renaming the tables.

wp_links: the table most sites never use

It stores blogroll entries for the Link Manager, which core hides on new installs unless the link_manager_enabled option is on. WordPress still creates the table, and it is normally empty. Leave it alone: it is tiny, and core’s schema code creates it again if it is missing.

What changes on a multisite network?

Three things change. First, wp_users gains two columns, spam and deleted, and the user tables are shared by the whole network. Second, six network-wide tables appear. Third, each additional site gets prefixed copies of the ten per-site tables.

Table

What it holds

wp_blogs

One row per site: domain, path, and the public, archived, mature, spam and deleted flags

wp_blogmeta

Key/value data attached to a site

wp_site

The network itself: domain and path

wp_sitemeta

Network-wide options, plus site transients

wp_signups

Pending user and site registrations waiting for activation

wp_registration_log

Records of past site registrations

The main site keeps the plain names (wp_posts). The second site is wp_2_posts, the third is wp_3_posts, and so on, for posts, postmeta, comments, commentmeta, terms, term_taxonomy, term_relationships, termmeta, options and links. Users and usermeta are not duplicated, which is why a role on site 2 lives in a usermeta key called wp_2_capabilities. Core also lists one retired table, sitecategories, in wpdb::$old_ms_global_tables since version 6.1.

A 50-site network therefore has about 500 per-site tables plus the shared ones. That is normal, but it is the reason a network-wide cleanup has to loop over sites instead of running one query. WP-CLI helps: wp db tables --scope=blog lists the current site’s tables, and wp db tables --network lists them all.

Are plugin tables default tables?

No. WordPress creates only the tables above. WooCommerce, Action Scheduler, form plugins, analytics plugins, membership plugins, backup plugins and security plugins add their own tables with the same prefix, and that is why two sites on the same WordPress version can have very different table lists. On our test site the three largest tables were not core tables at all: a plugin’s analytics events table and Action Scheduler’s actions table sat above wp_usermeta.

To see which tables are extras, compare the core list with what exists:

# Core tables registered to $wpdb for this site
wp db tables

# Everything that starts with your prefix, including plugin tables
wp db tables --all-tables-with-prefix

# Sizes, biggest problems first
wp db size --tables --size_format=mb

Checked on 15 November 2026 with WP-CLI 2.12.0. A table left behind by a plugin you deleted years ago is the most common reason a database is bigger than the content suggests. Plugins differ on whether they remove their tables when you delete them, so check before assuming.

Back up before you clean anything

Every step below deletes rows. A deleted row does not come back, and the mistakes people report (see further down) are nearly all deletions that looked safe. Take two backups: a full database export you have confirmed opens, and a host-level snapshot or staging copy if you have one.

# Export the whole database to a file outside the web root
wp db export ~/backups/before-cleanup-$(date +%F).sql

# Confirm the file is not empty
ls -lh ~/backups/before-cleanup-*.sql

A backup that sits on the server you are about to edit is a weak safety net. Download it or push it off the machine. If you would rather not run this yourself, our team sells WordPress care plans that include maintenance, one option among many. Your host’s snapshot tool, a staging site and the guide to WordPress backup solutions cover the same ground for free or for little. Run the cleanup on staging first when the database is large.

Where does database bloat come from?

Five default tables account for nearly all of it, and the same few causes repeat:

Table

Usual bloat source

Safe to clean?

wp_options

Large autoloaded rows, expired transients, settings left by deleted plugins

Yes for expired transients. Autoload changes need care, see below.

wp_postmeta

Rows whose post no longer exists, page-builder data, leftover plugin keys

Only truly orphaned rows, after a backup.

wp_posts

Revisions, auto-drafts, trashed items, cached oEmbeds

Yes, through WordPress functions rather than raw SQL.

wp_comments and wp_commentmeta

Spam and trashed comments

Yes. Spam you have not reviewed is the only thing to check first.

wp_usermeta

Session tokens and per-user plugin data for accounts that no longer matter

Remove the users, not the rows.

How do you find the heaviest tables first?

Start with measurement. Guessing wastes an afternoon and sometimes breaks something.

# Table sizes in MB
wp db size --tables --size_format=mb

# Row counts by post type (revisions and auto-drafts show up here)
wp db query "SELECT post_type, COUNT(*) AS n FROM wp_posts GROUP BY post_type ORDER BY n DESC LIMIT 10"

# Most common postmeta keys
wp db query "SELECT meta_key, COUNT(*) AS n FROM wp_postmeta GROUP BY meta_key ORDER BY n DESC LIMIT 10"

Checked on 15 November 2026 on WordPress 7.1.4. The post type query on our test site showed 107 revisions beside 369 attachments, and the meta key query showed that attachment keys and one plugin’s demo-content flag dominated wp_postmeta. Your numbers will differ. The point is to let the counts, not habit, choose what to clean.

How do you check and shrink autoloaded options?

Autoloaded options are read on every request, so a large total costs time even on pages that never use those settings. Core’s Site Health screen flags the problem above 800 KB. Measure it properly first. On our 7.1.4 test site, wp option list --autoload=on --format=total_bytes reported 86,174 bytes, while the set WordPress actually loads (wp_load_alloptions()) serialised to about 227 KB. The gap lines up with the 522 rows set to auto, which hold about 109 KB of values and are not matched by that filter. A SQL query that uses all four values avoids the trap.

-- Total size of everything WordPress actually autoloads
SELECT COUNT(*) AS rows_loaded,
       ROUND(SUM(LENGTH(option_value)) / 1024) AS kb
FROM wp_options
WHERE autoload IN ('yes', 'on', 'auto-on', 'auto');

-- The ten largest autoloaded rows
SELECT option_name, LENGTH(option_value) AS bytes
FROM wp_options
WHERE autoload IN ('yes', 'on', 'auto-on', 'auto')
ORDER BY bytes DESC
LIMIT 10;

Run them with wp db query "..." or in phpMyAdmin. Checked on 15 November 2026: both statements ran without errors on WordPress 7.1.4.

Read the names before you act. rewrite_rules and wp_user_roles are large on every site and WordPress needs both. Rows with a plugin’s prefix are what you are after. If the plugin is gone, the row is an orphan. If the plugin is active, ask the plugin’s support first, because setting autoload to off on a setting the plugin reads on every page just moves the cost into an extra query.

Changing autoload is reversible, deleting is not, so prefer the first:

# See the current autoload value of one option
wp option get-autoload some_plugin_big_cache

# Stop autoloading it (the value stays in the database)
wp option set-autoload some_plugin_big_cache off

Checked on 15 November 2026: we added a throwaway option on the 7.1.4 test site, switched it to off with set-autoload, read it back and deleted it. If your WP-CLI is too old to have these subcommands, update it. Avoid a bulk UPDATE wp_options SET autoload = 'off' with a pattern, and change one named row at a time.

How do you delete expired transients safely?

A transient is a cached value with an optional expiry, stored in wp_options as two rows: _transient_name and _transient_timeout_name. WordPress deletes expired ones through the delete_expired_transients() function, which returns early when a persistent object cache such as Redis or Memcached is active, because in that case transients are not in the database at all. If you added an object cache later, the old rows stay behind. We cover the details in our guide to finding and deleting expired transients.

# Count expired transient timeouts first (read-only)
wp db query "SELECT COUNT(*) FROM wp_options WHERE option_name LIKE '\\_transient\\_timeout\\_%' AND option_value < UNIX_TIMESTAMP()"

# Delete only the expired ones
wp transient delete --expired

# On a multisite network, include network (site) transients
wp transient delete --expired --network

Checked on 15 November 2026. The count query ran on WordPress 7.1.4, and the --expired and --network flags match the WP-CLI transient delete reference. WP-CLI has no --dry-run flag here, which is why the counting query comes first. Avoid wp transient delete --all on a busy production site: it also removes valid transients, and every one of them will be rebuilt by visitors at the same moment.

How do you remove post revisions without breaking anything?

Revisions are rows in wp_posts with post_type = 'revision'. By default WP_POST_REVISIONS is true, which means unlimited, so a post edited 200 times keeps 200 revisions. Count them, delete them through WordPress, then cap future growth. Our guide on how to limit, disable and clean up post revisions goes through the trade-offs.

# How many revisions exist
wp post list --post_type=revision --format=count

# Delete them in batches of 100 using WordPress's own delete function
wp post list --post_type=revision --format=ids | xargs -n 100 wp post delete --force

# Keep the five most recent revisions per post from now on (wp-config.php)
define( 'WP_POST_REVISIONS', 5 );

Checked on 15 November 2026. The count command returned 107 on our 7.1.4 test site. The last line is PHP and goes in wp-config.php, not in the shell. Using wp post delete rather than a raw DELETE FROM wp_posts matters: WordPress removes the revision’s postmeta in the same call. A raw delete leaves those rows behind as orphans, which is the most common way wp_postmeta ends up bloated.

How do you find and delete orphaned postmeta?

Orphaned postmeta rows point at a post ID that no longer exists. They are almost always left by raw SQL deletes or by cleanup tools that remove posts without calling WordPress. Count first:

-- Read-only: how many orphans
SELECT COUNT(*)
FROM wp_postmeta pm
LEFT JOIN wp_posts p ON p.ID = pm.post_id
WHERE p.ID IS NULL;

-- Only after a verified backup: delete them
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts p ON p.ID = pm.post_id
WHERE p.ID IS NULL;

Checked on 15 November 2026. We ran both statements on WordPress 7.1.4, the delete inside a transaction we rolled back, and the count and the delete agreed (3 rows on our test site). On a table with millions of rows, run the delete on staging first and in batches, because one huge statement can lock the table and stall the site. MySQL does not allow LIMIT in a multi-table DELETE, so for chunks select a batch of orphan meta_id values first and delete by primary key.

Be careful with the word “orphan”. Some plugins store meta against IDs that are not posts, or create meta just before the post is saved. If a plugin is active, test its screens after the cleanup. The same applies to the many cleanup plugins that offer a “remove duplicate meta” option: a post can have several rows with the same key on purpose, so deleting by key alone can destroy valid data. Our comparison of WordPress database plugins shows what each one deletes by default.

What about spam comments, trash and auto-drafts?

These need no SQL. WordPress empties trashed posts after 30 days by default (EMPTY_TRASH_DAYS) and removes auto-drafts on a schedule. Spam stays until you remove it.

# Count spam, then delete it
wp comment list --status=spam --format=count
wp comment delete $(wp comment list --status=spam --format=ids) --force

Checked on 15 November 2026. Skim a handful of spam comments before you wipe the folder if you suspect false positives. Deleting comments through WP-CLI also deletes their wp_commentmeta rows.

Should you run OPTIMIZE TABLE afterwards?

Usually yes, but only after large deletions. Deleting rows from an InnoDB table frees space inside the file, not on disk, so the size on the host can stay the same or even look larger until the table is rebuilt. wp db optimize runs OPTIMIZE TABLE on every table. On a very large table, do it during a quiet period, because the rebuild takes a lock on some MySQL configurations.

wp db optimize
wp db size --tables --size_format=mb

Common mistakes people report

These come from threads on the WordPress.org support forums. Dates on the forum are shown as relative ages, so we list when we checked them rather than a posting date. Checked on 15 November 2026.

  • Deleting revisions with a cleanup plugin and still having a huge postmeta table. One user’s plugin removed about 2,500 revisions on a site with a few posts and a database over 100 MB, and the postmeta table, mostly page-builder data, stayed above 100 MB with thousands of orphan rows. The poster argued that core’s own delete removes the meta, so the plugin’s cleanup left it behind. The thread had no reply. Thread.
  • Deleting a big autoloaded plugin cache without asking the plugin. A Site Health warning on one site traced to a single autoloaded option of about 4.8 MB from a block-template plugin. The poster asked whether deleting it was safe, and nobody in the thread confirmed that. The plugin’s support team later said the issue was fixed. Thread.
  • Blaming core when one plugin caused the autoload warning. Two sites showed the warning right after a WooCommerce update. Deactivating plugins one at a time pointed at a theme’s companion plugin, and the poster was sent to that plugin’s support. Thread.
  • Deleting rows and seeing the table get bigger. A store owner removed old order meta with a query and found the table had more rows and a larger size afterwards. The reply was to run OPTIMIZE TABLE to reclaim space. Thread.
  • Deleting “duplicate” postmeta by key. In a thread about a cleanup plugin’s duplicate-meta feature, a user pointed out that a post can hold several rows with the same key, such as stock values, and the plugin’s author agreed the option should be manual and compare values. Thread.

Which tables should you never edit by hand?

Read as much as you like. Write to wp_posts, wp_users and wp_options only through WordPress functions or WP-CLI when you can. wp_users and wp_usermeta are the riskiest: wp user update and wp user delete keep roles, meta and authored content consistent, a raw edit does not. For URL changes, use wp search-replace, which handles serialised data, as our WP-CLI search-replace guide explains, instead of a find-and-replace in an SQL dump.

Frequently asked questions

How many tables does a default WordPress install have?

Twelve on a single site. On multisite there are 18 distinct table types: those twelve plus six network tables, with the ten per-site ones repeated for every extra site under a numbered prefix.

Is wp_options safe to empty?

No. It holds the site URL, active plugin list and rewrite rules. Delete specific rows you can identify, such as expired transients and options from plugins you have removed, and nothing else.

Can I delete the wp_links table?

You can, but there is no benefit. It is empty on most sites and WordPress recreates it on upgrade through the same schema code.

Why is my wp_postmeta table so big?

Each plugin that stores per-post data adds rows for every post. Check the most common keys with the query above, and look for orphans after any bulk post deletion.

Do plugin tables count as WordPress default tables?

No. WordPress core creates the tables in schema.php. Everything else was added by a plugin or theme and is that plugin’s responsibility.

Do I need to run OPTIMIZE TABLE regularly?

No. Run it after large deletions, not on a schedule. A table that has not had big deletes gains almost nothing.

A short checklist before you touch the database

  • Export the database and confirm the file opens.
  • Measure table sizes, row counts and autoload totals first.
  • Prefer WP-CLI commands that call WordPress functions over raw DELETE statements.
  • Change autoload to off before you consider deleting an option.
  • Test on staging when any table has more than a few hundred thousand rows.
  • Reload the front end, the admin and any plugin screens that use the cleaned data.

Checked on 15 November 2026 against WordPress core trunk and 7.1.4. If a future release adds a table, wp_get_db_schema() will show it first.

Part of the Wbcom Designs family

The all-in-one WordPress community stack

Also ours: wbcomdesigns.comvapvarun.combrndle.com