简体   繁体   English

MY SQL查询,用于从字段中删除所有标签

[英]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

移除所有<div tags with sql query< div><div id="text_translate"><p> 我有表名wp_posts并且在post_content列中有我的帖子的描述(HTML 格式)。</p><p> 我想要一个在 post_content 列中搜索并选择以<div class or no class>开头的标签并删除整个标签的查询。</p><p> 我不想删除标签内的任何内容,只需删除标签</p><p>这个:</p><pre> <div> or <div clas="sada"> some text </div></pre><p> 会变成这样:</p><pre> some text</pre><p> 我的 MYSQL 版本是 15.1。</p></div></div> - Remove all <div tags with SQL Query

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 移除所有<div tags with sql query< div><div id="text_translate"><p> 我有表名wp_posts并且在post_content列中有我的帖子的描述(HTML 格式)。</p><p> 我想要一个在 post_content 列中搜索并选择以<div class or no class>开头的标签并删除整个标签的查询。</p><p> 我不想删除标签内的任何内容,只需删除标签</p><p>这个:</p><pre> <div> or <div clas="sada"> some text </div></pre><p> 会变成这样:</p><pre> some text</pre><p> 我的 MYSQL 版本是 15.1。</p></div></div> - Remove all <div tags with SQL Query 移除所有<div>带有查询的标签</div><div id="text_translate"><p>我想从内容中删除所有<div>标签,我使用此查询,它只删除没有 class 的<div>标签,如何删除所有<div>,<div class"example">,</div> ?</p><pre> UPDATE wp_posts SET `post_content` = REPLACE (`post_content`, '<div>', '') WHERE `ID`=84259</pre><p> 我想要一个删除<%div%>的查询(% 意味着不管 div 之前和之后是什么)</p></div> - Remove all <div> tags with a query 使用SQL查询获取所有标签 - get all tags with sql query 查询以获取所有标签字段值并将所有值倒入字段 - Query to get a all tags field values and pour all value in field 从 html 标签中删除所有属性 - Remove all attributes from html tags 从文本中删除所有类型的标签 - remove all kind of tags from text "从 php 字符串中删除所有 html 标签" - Remove all html tags from php string 如何删除所有标签? - How to remove all tags? 我的SQL查询不会正确输出字段结果 - My SQL query will not output the field result correctly 试图从WordPress中的字段中删除所有空格 - Trying to remove all spaces from a field in WordPress
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM