WordPress如何将标题重复的文章一次性删除?

有些站长朋友使用wordpress做采集站,不断的采集各类文章自动发布到自己的网站上。但采集站最大的问题就是会采集到很多重复文章。这时,我们需将采集过来的重复文章进行去重处理。那么WordPress如何将标题重复的文章一次性删除?

WordPress如何将标题重复的文章一次性删除? (https://www.wp-admin.cn/) WordPress使用教程 第1张

以下是二种一次性去除标题重复文章的方法:

去除重复文章,只保留一篇

CREATE TABLE my_tmp AS SELECT MIN(ID) AS col1 FROM wp_posts GROUP BY post_title; DELETE FROM wp_posts WHERE ID NOT IN (SELECT col1 FROM my_tmp); DROP TABLE my_tmp;

去除重复文章,一片都不保留

CREATE TABLE my_tmp AS Select ID AS col1 From wp_posts Where post_title In (Select post_title From wp_posts Group By post_title Having Count(*)>2); DELETE FROM wp_posts WHERE ID IN (SELECT col1 FROM my_tmp); DROP TABLE my_tmp;

另一种去除所有重复文章的方法

CREATE TABLE my_tmp AS Select ID AS col1 From wp_posts Where post_title In (Select post_title From wp_posts Group By post_title Having Count(*)>2);DELETE FROM wp_posts WHERE ID IN (SELECT col1 FROM my_tmp); DROP TABLE my_tmp;

操作方法很简单,只需将上面的SQL语句,放到自己网站数据库的 SQL框里,然后执行就可以了。

相关推荐

发表回复

房先生
我们将24小时内回复。
2024-10-09 08:54:44
您好,有任何疑问请与我们联系!
您的工单我们已经收到,我们将会尽快跟您联系!
[QQ客服]
2781198
加我微信
[电话联系]
13585372227
[电子邮件]
chaoneo@163.com
取消

选择聊天工具: