【问题标题】:SQL command to update posts in Wordpress database用于更新 Wordpress 数据库中的帖子的 SQL 命令
【发布时间】:2014-02-27 00:39:55
【问题描述】:

一些用户在我的网站上添加了用于获利的链接。 它们采用以下形式:

"href="http://redirect.viglink.com/?key=11fe087258b6fc0532a5ccfc924805c0&u=http%3A%2F%2Fsports.ca.msn.com"

我想搜索/替换所有帖子(大约 200,000 个),以便任何与上述类似的链接,删除链接的“http://redirect.viglink.com/?key=11fe087258b6fc0532a5ccfc924805c0&u=http%3A%2F%2F”部分,只留下“http://sports.ca.msn.com

下面的 sql 能解决问题吗:

update wp_posts set post_content =
replace(post_content,'http://redirect.viglink.com/?key=11fe087258b6fc0532a5ccfc924805c0&u=http%3A%2F%2F','http://')

【问题讨论】:

    标签: sql wordpress


    【解决方案1】:

    我认为你说得对。

    但我也认为您可能希望将这个WHERE post_content LIKE %redirect.viglink.com% 添加到 SQL 语句的末尾。

    WHERE 只是让它更快,但不是必需的。

    【讨论】:

      猜你喜欢
      • 2021-11-03
      • 1970-01-01
      • 2014-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-20
      • 1970-01-01
      • 2013-02-05
      相关资源
      最近更新 更多