1

Is there any way to find similar/duplicate wordpress posts by post_content.

I have tried "Find Duplicates" plugin but it takes a lot of time to search since I have more than 7000 posts in my database.

What I want to achieve is search the posts published in current week with all the old posts and find similar posts and delete them.

4

Try to use the following SQL query to fetch duplicate posts:

SELECT p2.* 
  FROM wp_posts AS p1
  LEFT JOIN wp_posts AS p2 ON p1.post_content = p2.post_content 
   AND p2.ID < p1.ID 
   AND p1.post_type = p2.post_type 
   AND p1.post_status = p2.post_status
 WHERE p1.post_type = 'post' AND p2.ID IS NOT NULL
1
  • This worked well for me. Since this query only compares the post content, you can check to see if any posts have matching titles by repeating the query but replacing p1.post_content = p2.post_content with p1.post_title = p2.post_title.
    – jg314
    Aug 21 '17 at 19:59
1

I got a very good result using JetPack plugin by WordPress.com's Omnisearch.

Install the plugin, activate it using a free WordPress.com account and activate the "Omnisearch" feature. Your tool is ready.

Now open the post from where you want to take the post content to search, copy some text and try an Omnisearch with it. If a longer sentence is not effective, try a shorter sentence, most likely find its repeat.

Let me know whether it works for you or not.

2
  • 1
    This works but I want to do it for a chunk of posts. Something like sql query?
    – Tarun
    Sep 15 '13 at 9:28
  • 1
    @Tarun: For Seek&Replace or Seek&Do_Action scenario, for any trick you have to provide the texts to search for. And for that you have to explore all your posts individually to copy the whole texts or a part of texts. Then the engine will search for the selected or provided strings, nah? Sep 15 '13 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.