I have a lot of duplicate posts. So, how to delete them (only keep 1 post). If they have same title, they are duplicate posts. Thank you very much ! Have a nice day !
2 comments
Comments are closed.
I have a lot of duplicate posts. So, how to delete them (only keep 1 post). If they have same title, they are duplicate posts. Thank you very much ! Have a nice day !
Comments are closed.
I’m not entirely sure you can do this with a single query in MySQL as you can’t delete from tables which you reference in a sub-query. I would actually recommend doing this using wp-cli and using the WordPress API to delete the duplicate posts (which will also delete any post meta and associated term references):
Hope this helps.
I know, it’s an old thread but since i had a similar problem i would like to add some advises to the Answer from Bendoh (unfortunately i dont have the reputation to make a comment)
Since wordpress and some Plugins are also storing data in the post table, i would recommend to add an post_type to your querry:
Depending of the source of your duplicates i would also add another field to check for duplicates, like the publication date.