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

点赞
  1. typecho模板说道:

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

    1. 小马哥哥说道:

      是的,简单粗暴

发表评论

电子邮件地址不会被公开。必填项已用 * 标注

7 + 1 =