Skip to content

Instantly share code, notes, and snippets.

@thinkstylestudio
Forked from BFTrick/sql-command.sql
Last active August 29, 2015 14:25
Show Gist options
  • Save thinkstylestudio/c83b9e5551c0f7dd2af1 to your computer and use it in GitHub Desktop.
Save thinkstylestudio/c83b9e5551c0f7dd2af1 to your computer and use it in GitHub Desktop.
A SQL command to delete all orphaned post meta data
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