WordPress批量删除重复文章标题的代码

来源:网络整理  作者:佚名  4 次阅读

WordPress批量删除重复文章标题的代码:

只需将下面的SQL语句,放到自己网站数据库的 SQL框里,然后执行就可以了。

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;

2、去除重复文章,一片都不保留
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;



本文地址:https://www.yiwen55.com/83751.html
版权声明:本文来源于网络公开资源整理,版权归原作者所有,欢迎分享本文,转载请保留出处!