Forked from jchristopher/searchwp-customizations.php
Created
October 15, 2021 10:54
-
-
Save BrElio/1590418b8c6deb45fba586a476a060d3 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