[resolved] I keep getting duplicate content during every fetch (11 posts)

  1. keithp
    Posted 4 years ago #


    First of all, I think thisis a great plugin. The features are outstanding.

    But, everytime i have a schedule fetch, at times, itwill repost an article on my site that was posted by Wpematico during the last fetch.

    one time, I had the article sho up on my site, 7 times.

    How can I fix this

    At first, i had the fetch set up at any, because I wanted to fetch as soon the rss feeds updated, but i changd it to an hour.

    Is here any way I can fetch every 5 minutes without wpematico fetching the same article they posted on my site 5 minutes ago?


  2. gdaddy
    Posted 4 years ago #

    Does it have a single quote in the title? If so, go to the wpematico_dojob file, isDuplicate function, under the line that says -
    $title = $item->get_title();
    $title2 = str_replace("'","''",$title);
    and in the query below it, change $title to $title2

    had the same issue

  3. MyShadowSelf
    Posted 4 years ago #

    Nice find gdaddy. Been banging my head on this problem all day, should've looked here first.

  4. RoamFree
    Posted 4 years ago #

    This shows that SQL injection is possible, and the plugin is probably vulnerable in other places. Maybe a better choice if you're using MySQL:

    $title2 = mysql_real_escape_string($title);

  5. amplifiedshock
    Posted 4 years ago #

    I tried the fix above and it seems to be working for titles with single quotes in it.

    However, it still posts duplicates if it contains a colon now.

  6. RoamFree
    Posted 4 years ago #

    amplifiedshock: Which fix: str_replace() or mysql_real_escape_string()?

    I'm running with mysql_real_escape_string() and two titles yesterday had colons without a duplicate problem.

    Are the titles identical, or is there a subtle difference, such as spaces or what is at the end of the title?

  7. RoamFree
    Posted 4 years ago #

    And I have a correction... WP has a function which is already being used elsewhere in the code to clean up incoming strings. This seems to be what is needed:

    $title2 = $wpdb->escape($title);

    And then replace $title in the following line with $title2.

  8. amplifiedshock
    Posted 4 years ago #

    You were right, it seems like there WAS a tiny difference in the title of the duplicate article!

    I guess mysql_real_escape_string() was working perfectly. I'll test your latest correction now.

  9. bspr3663
    Posted 4 years ago #

    Hey guys, any idea how to stop duplication of titles with the character = &

    Thanks in advance

  10. techyhippy
    Posted 4 years ago #

    same issue.. thanks folks for the fix. did pretty much as RoamFree suggested but just amended that line to:
    $title = $wpdb->escape($item->get_title());
    to save editing the query.

    thanks again folks.. saved me lots of messing about to figure it out myself!

  11. etruel
    Plugin Author

    Posted 4 years ago #

    thanks, this fix come in next version.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WPeMatico
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic