Support » Plugin: Wp RSS Importer » Duplicate RSS entries

  • Good afternoon,

    Sorry to bother you again, but I noticed that the RSS import function (runcron_callback()) is bringing in duplicates. So I was hoping that the following code on line 162 of wp-rss-importer.php file:

    $my_post = array(
        'post_type'     => $rdata['pid'],
        'post_title'    => $entry->title,
        'post_content'  => $desc,
        'post_status'   => 'publish',
        'post_author'   => 1
    );
    
    // Insert the post into the database
    $post_id = wp_insert_post( $my_post, false);
    if(get_option(logics_source_url_meta) == 1) {
        add_post_meta( $post_id, 'wpri_sourcelink', $xmltoarray[0] );
    }
    wp_set_object_terms( $post_id, $termArray, $rdata['taxid'] );
    global $wpdb;
    $result = $wpdb->query(
        $wpdb->prepare(
                "
                UPDATE $wpdb->rss_settings
                SET isrun = %d
                WHERE id = %d",
                '1',
                $rdata['id']
            )
        );
    }

    can all be within if(post_exists($entry->title)){…//code form above;}. THat will simply check if title exists and if so it will prevent a duplicate from being inserted.

    Thank you.

    https://wordpress.org/plugins/wp-rss-importer/

Viewing 1 replies (of 1 total)
  • Plugin Author dileep1984

    (@dileep1984)

    Yes Elliot, You are right. This condition will break duplicate entry.
    Although in manual run this condition is applied but not available in cron function.
    Thank you for point it. I will add this condition.

    Thanks again.

Viewing 1 replies (of 1 total)
  • The topic ‘Duplicate RSS entries’ is closed to new replies.