[英]MY SQL Query for remove all a tags from field
I have a WordPress website, which was under malware attack recently. 我有一个WordPress网站,该网站最近受到恶意软件攻击。 I manage to remove all malware files and ad security. 我设法删除了所有恶意软件文件和广告安全性。
But that hacker injected some random urls like below to end of all post contents. 但是该黑客在所有帖子内容的末尾注入了一些如下所示的随机URL。 site have around 1.5k posts. 网站上有大约1.5k个帖子。
<a href="http://www.cgparkaoutlet.com">canada goose outlet</a> <a href="http://www.cgparkaoutlet.com">canada goose outlet</a>
I need to remove this these links. 我需要删除这些链接。 already tested this mysql but it's not working 已经测试过此mysql,但无法正常工作
UPDATE wp_posts SET post_content = REPLACE(post_content, substring_index( substring_index(post_content, 'href="', -1), '"', 1),'');
UPDATE wp_posts SET post_content = REPLACE(post_content, '<a href="">','');
UPDATE wp_posts SET post_content= REPLACE(post_content, '<a href="" target="_blank">','');
UPDATE wp_posts SET post_content= REPLACE(post_content, '</a>','');
anyone know how to remove those links from all posts without aging contents. 任何人都知道如何从所有帖子中删除这些链接而不会老化内容。 Thank You 谢谢
I suggest you , use wp_strip_all_tags wordpress function for example : 我建议您使用wp_strip_all_tags wordpress函数,例如:
global $wpdb;
$wpdb->query("update `wp_posts` set post_content = ".wp_strip_all_tags( $string ) ....);
https://codex.wordpress.org/Function_Reference/wp_strip_all_tags https://codex.wordpress.org/Function_Reference/wp_strip_all_tags
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.