Support » Fixing WordPress » Duplicates of scheduled posts SQL

  • Instead of using plugins I want to use an SQL cron to complete this task.

    I want to delete duplicates out of the database but I want it to compare scheduled or “future” wp_post.post_status to “published” posts. If it’s a future post I want it to be deleted and leave the published post alone.

    This is what I was using which is slightly modified but it does not just limit to “future” or scheduled posts.

    SELECT bad_rows. *
    FROM wp_posts AS bad_rows

    SELECT post_title, post_status, post_content, MIN( id ) AS min_id
    FROM wp_posts WHERE post_status = “future”
    GROUP BY post_title, post_content
    HAVING count( * ) >1) AS good_rows ON good_rows.post_title = bad_rows.post_title
    AND good_rows.post_content = bad_rows.post_content
    AND good_rows.min_id <>

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Duplicates of scheduled posts SQL’ is closed to new replies.