Skip to content

Instantly share code, notes, and snippets.

@jamiebrwr
Created September 28, 2013 16:39
Show Gist options
  • Save jamiebrwr/6743874 to your computer and use it in GitHub Desktop.
Save jamiebrwr/6743874 to your computer and use it in GitHub Desktop.
Here is a simple SQL query to delete orphaned post meta on your database.
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