Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Duplicate results after search
This topic contains 5 replies, has 2 voices, and was last updated by Ernest Marcinko 2 weeks, 3 days ago.
- AuthorPosts
- March 7, 2023 at 11:22 am #41659
Hi,
In the last few days something strange has happened: after filtering or searching contents through the plugin on the website, (for example on this page https://venetofilmcommission.com/it/attrici_attori/ or this page https://venetofilmcommission.com/it/production-guide/tutti-i-professionisti/) the first two results of the search are duplicated. And this happens in each kind of content where the filters are used.After trying to follow the examples found on this forum:
https://wp-dreams.com/forums/topic/duplicate-results/
https://wp-dreams.com/forums/topic/duplicate-search-results-2/
I tried to downgrade the plugin and see if this would help, but nothing changed.Through the error log, I found a main issue related to Advanced Custom Fields Frontend Admin plugin, so I deactivated it, but still, the problem hasn’t been solved, so I tried to solve downgrading it too, but the duplicate results are still there. I’ll send you some attachments.
Can you please help me?
thank you in advance
regards
RAttachments:
You must be logged in to view attached files.March 7, 2023 at 1:39 pm #41665Hi,
I recall a similar issue, it was related to ECS custom posts widget or something similar, see the discussion here. Some of the ticket is private, but basically they raised an issue with the developer here, some others have also reported the problem. Unfortunately they could not find the issue, but it had to do something with WP 6.0, reverting to 5.9 resolved the problem.
If you happen to use ECS or any custom post addon, then it is very likely the cause of the problem here. Unfortunately we can’t guarantee support for 3rd party Elementor addons. Switching to the original posts widget should resolve the problem. The search definitely does not return duplicates, it can’t because the query is distinctive by post IDs. When I debugged the upper mentioned ticket, I found that the plugin actually returned the correct items, simply the posts widget decided to display the first one 2 times – in your case the first 2.
I also remember another topic (I could not find it), where stickied posts caused this issue. You can check if these items by any chance sticked, maybe that also affect the duplication.
Best,
Also try different widget configurations, check if there is any custom query enabled, anything with sticky posts, extra meta queries or anything like that.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 8, 2023 at 11:22 am #41674Hi,
thank you for the quick response.All the filtered contents are custom contents and they are not conceived to be sticky, so if you assure that ASP set up is ok and it is working well, it seems that the problem is related to Elementor and/or ECS, definitely.
I read the discussions you linked me, I’ll try to do the same thing the other users did and we’ll see…In case the action wouldn’t fix anything, would it be possibile for you to help me writing a snippet as you did in this case?
Not such a clean solution maybe, but it seems efficient 😉thank you for now, I’ll let you know asap.
best regards
RMarch 8, 2023 at 12:58 pm #41676Sure, we can try something.
Make sure to have the plugin updated to the latest version, then try this custom code:
add_action('wp_footer', 'asp_custom_footer_script', 99999); function asp_custom_footer_script() { ?> <script> (function($){ $('.asp_m').on('asp_elementor_results', function(){ let id = $(this).data('id'); let seen = []; $('.asp_es_' + id + ' .elementor-post').each(function(){ if ( seen.includes(this.className) ) { $(this).remove(); } else { seen.push(this.className); } }); }); }(WPD.dom)); </script> <?php }
If all goes well, this will detect duplicates and remove them before they are displayed.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 14, 2023 at 5:35 pm #41755Hi,
at least downgrading to the 5.9 was helpful.
Thank you for the snippet by the way I’m saving it for the future 😉Hope the bug with WP 6.0 will be fixed anyway, it is pretty annoying.
Thank you very much for your precious help.
best regards
RMarch 15, 2023 at 12:34 pm #41767You are welcome.
I will try to somehow integrate this mechanism to the upcoming patch, it should not be too complicated, and would resolve any possible future conflicts as well.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.