Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Duplicate results after search › Reply To: Duplicate results after search
March 8, 2023 at 12:58 pm
#41676
Keymaster
Sure, 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.