mysql查询从字段中删除所有a标记

x33g5p2x  于 2021-06-17  发布在  Mysql
关注(0)|答案(1)|浏览(338)

我有一个wordpress网站,最近受到恶意软件攻击。我设法删除所有恶意软件文件和广告安全。
但那个黑客在所有帖子内容的结尾注入了一些如下的随机网址。该网站有大约1.5公里的职位。

<a href="http://www.cgparkaoutlet.com">canada goose outlet</a>  <a href="http://www.cgparkaoutlet.com">canada goose outlet</a>


我需要删除这些链接。已经测试过这个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>','');

任何人都知道如何删除这些链接从所有职位没有老化的内容。谢谢您

1l5u6lss

1l5u6lss1#

我建议您使用wp\u strip\u all\u 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

相关问题