title: How delete duplicate Wordpress posts in DB
body: <p>When I run this code on my wp_posts table (using phpmyadmin), it returns a single duplicate post.</p>
  
  <pre><code>SELECT a.ID, a.post_title, a.post_type, a.post_status
  FROM wp_posts AS a
   INNER JOIN (
     SELECT post_title, MIN( id ) AS min_id
     FROM wp_posts
     WHERE post_type = 'post'
     AND post_status = 'publish'
     GROUP BY post_title
     HAVING COUNT( * ) &gt; 1
   ) AS b ON b.post_title = a.post_title
  AND b.min_id &lt;&gt; a.id
  AND a.post_type = 'post'
  AND a.post_status = 'publish'
  </code></pre>
  
  <p>Note that this given post is actually not a duplicate, it only has the same title as another one (a normal behaviour given the code above looks for duplicate titles). However, the problem is that there are actually hundreds of duplicate posts in the database (I can see them if I look manually), so why can't I find them using the above code?</p>
  
  <ul>
  <li>I can also see those two duplicate posts from the wordpress admin panel...</li>
  <li>I also tried to use a few Wordpress plugins and they all found the same duplicate post as the code above, but none of the others).</li>
  </ul>
  
  <p>Edit : If I look at two random duplicates, one has:</p>
  
  <pre><code>ID 9462
  post date 2017-03-07 13:06:31
  post content "foo"
  post title "Les pendules à l'heure"
  post status "publish"
  post type "post"
  guid "http://www.exemple.com/?p=9462"
  </code></pre>
  
  <p>The other has:</p>
  
  <pre><code>ID 11409
  post date 2017-03-07 13:06:31
  post content "foo"
  post title "Les pendules à l&amp;#039;heure"
  post status "publish"
  post type "post"
  guid "http://www.exemple.com/?p=9462"
  </code></pre>
  
  <p>Thanks</p>