Created
April 22, 2020 18:44
-
-
Save jchristopher/21bb196c8704664576de5a75b3b4d104 to your computer and use it in GitHub Desktop.
Add relevance weight to a single SearchWP Source
This file contains 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 | |
// Add relevance weight to a single SearchWP Source. | |
add_filter( 'searchwp\query\mods', function( $mods ) { | |
global $wpdb; | |
$mod = new \SearchWP\Mod(); | |
$mod->weight( "IF(s.source = 'user', 9999999, 0)" ); | |
$mods[] = $mod; | |
return $mods; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment