How To Delete Duplicate Posts in WordPress

A common problem often encountered is the creation of duplicate posts in WordPress. This usually happens as soon as you start using automation plugins and/or feeds content to your blog via RSS.

UPDATE: I have created a WordPress plugin called Delete Duplicate Posts, you can read more about it here.

This common problem is encountered often, and I released a plugin back in 2009 (still under development) that deletes duplicated posts or pages. Read more on the plugin page WordPress Delete Duplicate Posts or directly at the wordpress.org plugin page.

You can also do it manually via MySQL:

DELETE bad_rows.*
from wp_posts as bad_rows
inner join (
select post_title, MIN(id) as min_id
from wp_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

Note: Above example is when you have “wp_” as your table name prefix. Also, note you really should back up your website before you run this MySQL query. Things can go really wrong if you do not.

The above code is provided by comments from the WordPress Support Forum, as well as from Kieran Barnes – Wordpress WP-O-Matic Duplicate Posts Fix.