hamedmoody
11/10/2017 - 4:57 PM

Delete all orphans user meta in WordPress Raw

Delete all orphans user meta in WordPress Raw

DELETE FROM wp_usermeta
WHERE NOT EXISTS (
  SELECT * FROM wp_users
	WHERE wp_usermeta.user_id = wp_users.ID
)

DELETE FROM wp_postmeta
WHERE NOT EXISTS (
  SELECT * FROM wp_posts
	WHERE wp_postmeta.post_id = wp_posts.ID
)