Duplicate post fix by wp-o-matic wordpress


Solution for WP 2.7

Replace $suffix = 2
With return 0;

You will find $suffix = 2 twice in wp-includes/post.php
by http://www.cypher-sec.org/blog/

or another solution

Got a problem with WP-O-Matic creating duplicate posts? Or just WordPress in general. Me too.

I wrote a script to run on a regular basis so sort this problem out.Create wp-posts-cleanup.php in your wordpress/wp-config/plugins/ directory,

WordPress WP-O-Matic Duplicate Posts Fix

8 thoughts on “Duplicate post fix by wp-o-matic wordpress

  1. Did not work for me.

    I use a temporary solution :

    Check if the post is duplicated after the creation (based on date creation and author), and then delete it.

    if( $wpdb->get_var($wpdb->prepare(“SELECT count(ID) FROM $wpdb->posts WHERE post_date = %s AND post_author = %s”, $date, $author)) > 1 ){
    $id_a_supprimer = $wpdb->get_var($wpdb->prepare(“SELECT ID FROM $wpdb->posts WHERE post_date = %s AND post_author = %s”, $date, $author));
    echo $id_a_supprimer;
    $wpdb->get_var($wpdb->prepare(“DELETE FROM $wpdb->posts WHERE ID = %s”, $id_a_supprimer));
    }

    This bug appears to be here for a while now, that’s a real shame (all topics from wordpress closed without giving a solution)

  2. I was very happy to discover this web site. I wanted to thank you for ones time due to this wonderful read!! I definitely really liked every bit of it and I have you book marked to look at new things on your site.

  3. The problem is that for reasons not yet known Wpomatic is called
    at runCron every 12 seconds after the first call from the Unix cron
    job. If processing the feeds goes past 12 seconds (or so) a second
    thread starts processing the feeds. The processing and duplicate
    post checking is not thread safe so no matter what you do, you are
    just moving the problem around. If processing takes over 25 seconds
    a third thread is started and you may get triple posts.

    The solution that I used, short of locating the cause of the
    multiple threads, is to add code in runCron that checks the time.
    Since I set the Unix cron for once an hour on the hour, any call
    to runCron more that 15 seconds after the hour is ignored.

    function runCron($log = true)
    {
    $tdate = getdate();
    $min = $tdate[‘minutes’];
    $sec = $tdate[‘seconds’];

    $this->log(‘Running cron job ‘ . $min . ‘:’ . $sec);

    if ( ($min != 0) || ($sec > 10) ) {
    $this->log(‘Skipping processAll’ . $min . ‘:’ . $sec);
    return;
    }

    // $this->log(‘Running cron job’);

    $this->processAll();
    }

    Problem solved!

    I have read code till I am blue in the face and cannot figure out the
    cause of the multiple threads.

  4. I believe the problem is with CURL, the Unix command used to call wp-o-matic if you use Unix Cron. I believe that some hosts have set a short retry timeout so that if the response to the “get” takes too long, a second, third, etc. “get” is issued until the site responds. It could be that updating the CURL parameters on the provide CURL command in wp-o-matic will solve this problem without changing the code.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s