Skip to content

Orphaned metadata in WordPress

WordPress stores extra information about posts, users, comments and terms in separate tables, as metadata: a product’s price, a page builder’s layout, a user’s settings. Each entry points to the item it belongs to. When that item no longer exists, the entry is orphaned: it’s still in the database, but nothing uses it anymore.

Orphaned metadata takes up space and makes the metadata tables larger, especially the one for posts, which on many sites is the largest table of all. Large metadata tables slow down the queries that search them.

A few orphans are harmless. And not everything that looks orphaned is: some plugins store data in ways that don’t follow the usual pattern. That’s why the count is a hint, not a list of things to delete.

WordPress: When WordPress deletes a post, user or comment through its own functions, it removes the metadata too. Orphans are left behind when that step is skipped: a plugin that deletes items directly in the database, an import or deletion that was interrupted, a migration, or manual changes to the database. On Multisite, each site has its own tables, so the right table has to be checked.

The Orphaned metadata card is in System info, tab Database, under Cleanup potential. Permo counts only when you select Count now, because the count searches all four metadata tables, for posts, comments, terms and users, and can take a while on a large site.

  • Green below 1,000 entries.
  • Yellow from 1,000.

The note says whether most entries belong to posts (Mostly post data) or are spread Across several tables, and when Permo last counted; Count again repeats the count. Permo only counts and deletes nothing.

Sources