wordpress快速删除重复文章的SQL语句

有几个采集的小站,有时候采集规则出问题,导致网站出现大量的重复文章。因此找到这个SQL语句,体验之后发现效果出众。

DELETE a.* FROM wp_posts AS a INNER JOIN ( SELECT post_title, MIN( id ) AS min_id FROM wp_posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY post_title HAVING COUNT( * ) > 1 ) AS b ON b.post_title = a.post_title AND b.min_id <> a.id AND a.post_type = 'post' AND a.post_status = 'publish' 

作者:code-is-poetry

2 条回复

  1. 最近发现有时候建站还是直接sql来的有效,别的方法太麻烦了

发表回复

您的电子邮箱地址不会被公开。