sql query to delete orphaned post meta in your WordPress database
Just run the following query on your WordPress database to delete orphaned post meta. Don't forget to replace the table prefix wp_ if your database is using another prefix.
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
Written by Thibault Milan
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mysql
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#