Delete Orphaned Post Meta Data in WordPress

before you go with this please backup your date i am not responsible about your errors 🙂
enjoy

[php]
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
[/php]