如何删除在WordPress重复发布(How to delete Duplicate posts i

2019-10-17 06:43发布

我有许多文章这是重复的,这意味着一个文章是写1倍以上。 我想通发现使用此MySQL命令这些:

select post_title,post_content,count(*) as count from wp_posts
group by post_content
having count(*)>1
ORDER BY count(*)  DESC

但是,我怎么能只删除重复的职位,因此,如果任何岗位已超过1个复制,那么只有1副本将被留下。

的任何方法,将不胜感激。

Answer 1:

尝试以下之前我建议备份您的SQL数据库

尝试:

DELETE bad_rows . * FROM ktz3_posts AS bad_rows INNER JOIN (
  SELECT post_title, MIN( id ) AS min_id
  FROM ktz3_posts
  GROUP BY post_title
  HAVING COUNT( * ) >1
  ) AS good_rows ON good_rows.post_title = bad_rows.post_title
AND good_rows.min_id <> bad_rows.id

正如上面的代码是未经测试,你可以尝试复制后卸妆 。



文章来源: How to delete Duplicate posts in WordPress