Skip to content

Instantly share code, notes, and snippets.

@braddalton
Forked from BFTrick/sql-command.sql
Last active December 14, 2015 14:59
Show Gist options
  • Save braddalton/5104928 to your computer and use it in GitHub Desktop.
Save braddalton/5104928 to your computer and use it in GitHub Desktop.
Run this database query in phpMyAdmin to remove all your orphaned post meta database tables. Note: Backup your DB first
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment