Created
January 11, 2021 10:24
-
-
Save jchristopher/5768ed53d30bae8f74dca8c470adb8af to your computer and use it in GitHub Desktop.
Randomize SearchWP results
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Randomize SearchWP search results. | |
add_filter( 'searchwp\query\mods', function( $mods ) { | |
$mod = new \SearchWP\Mod(); | |
$mod->order_by( 'random', null, 1 ); | |
$mods[] = $mod; | |
return $mods; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment