如何删除WordPress中的重复帖子 [英] How to delete Duplicate posts in WordPress

查看:88
本文介绍了如何删除WordPress中的重复帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多重复的文章,这意味着一篇文章被撰写了不止一次。我想找到使用此MySQL命令的人:

I have many articles which are duplicates, which means that one article is written more than one times. I have figured to find those using this MySQL command:

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

但是,如何删除重复的帖子,因此,如果任何帖子有多于1个副本,则仅将保留1个副本。

but, How can I delete only the duplicate posts, so that if any post has more than 1 copy, then only 1 copy will be left.

任何方法将不胜感激。

推荐答案

建议您先尝试备份您的SQL数据库,然后再尝试以下操作。

I advise backing up your SQL database before trying the below.

尝试:

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

由于上述代码未经测试,因此可以尝试复制帖子删除器

As the above code is untested, you could try the Duplicate Post Remover.

这篇关于如何删除WordPress中的重复帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆