Delete the Custom Fields from your postmeta table where assigned posts no longer exist.
This is exactly what I was looking for! It worked pretty good for what I needed.
One improvement I would suggest is to find a way to deal with massive amounts of unused post meta. I had about 100,000 rows of unused post meta, and it wouldn't work. I deleted a bunch I knew for sure I didn't need, got it under 20,000 and it worked fine.
You must log in to submit a review. You can also log in or register using the form near the top of this page.