Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Randomize matched results? › Reply To: Randomize matched results?
January 1, 2019 at 7:52 pm
#20613
Participant
I decided to randomize my results in the following way, I think it works, and I hope it can help others!
add_filter('asp_user_results', 'randomize_results', 10, 2);
function randomize_results($user_results, $search_id) {
if ($search_id == 1) {
shuffle($user_results);
}
return $user_results;
}