方法一:Delete Duplicate posts插件删除
推荐使用Delete Duplicate Posts插件删除重复的帖子,通过删除重复的帖子及其元数据来帮助您整理您的 WordPress 网站。
下载地址:https://cn.wordpress.org/plugins/delete-duplicate-posts/#description
方法二:sql查询删除
直接操作数据库可能会有风险,记得备份。
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;
方法三:php批量删除
require('./wp-load.php'); $strsql="create table my_tmp as select min(ID) as col1 from cd_posts group by post_title"; $strsql1="delete from cd_posts where ID not in (select col1 from my_tmp)"; $strsql2="drop table my_tmp"; $result=mysql_query($strsql); $result=mysql_query($strsql1); $result=mysql_query($strsql2);
保存以上代码以为delete.php,放在根目录,想要删除重复文章的时候,访问这个文件就可以了