Duplicate posts when url contains parameters
-
I encountered an issue when urls in the RSS feed contain parameters.
I did a little research and found out that there is a function in app/classes/import/class-rss-pi-engine.php to check whether a post already exists.
The function post_exists is called before the insert of a post from the RSS feed.
Between lines 539 and 547 of the class rssPIEngine an md5 hash will be created based on the full url of the post (i.e. with parameters). This hash is checked against the meta-field rss_pi_source_md5 in wp_postmeta.
In the same class around line 648 the meta-field rss_pi_source_md5 is updated when the insert is happening. Here the md5 hash is based on the url without paramaters (i.e. everything before ?).
This means that posts from an rss feed where urls contains parameters, will never be correctly checked and eventually leads to duplicate posts.
What I did to fix this was add the following line after line 646 in the source code of the plugin.
$url_md5 = md5($url); // create md5 based on full url instead of without parametersWould like to know if my analysis is correct regarding duplicate posts with parameters.
If so, could this be updated in the plugin?Plugin version 2.2.3
Thanks in advance,
The topic ‘Duplicate posts when url contains parameters’ is closed to new replies.