0

I've been asked to remove some Malware from a friend's site.

I've found some wonky links in the wp_postmeta table, but the post_id that the field is associated with doesn't exist - and, weirdly, it's way too high. I think the fields have the meta_key that starts with _feedback_

What is the easiest way to search the meta_value on those fields (seems to be JSON?) and delete the bad ones?

I found this post that suggested:

DELETE * FROM wp_postmeta WHERE post_id NOT IN (SELECT ID FROM wp_posts)

But when I ran (with updated table names) I got 0 results, which I feel shouldn't happen?

SELECT * FROM wp_postmeta WHERE post_id NOT IN (SELECT ID FROM wp_posts)
2
  • 1
    But you genuinely do have an example of a postmeta row whose post doesn't exist in wp_posts? Maybe try selecting wp_postmeta where post_id = that, and double check selecting that ID from wp_posts. Without your data I'm not sure we can help you debug this. – Rup Jan 4 at 13:43
  • 1
    (P.S. it's just DELETE FROM not DELETE * FROM) – Rup Jan 4 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.