-
-
Save jchristopher/e7daa4a89d274182a2bfea88be67972c to your computer and use it in GitHub Desktop.
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 (Posts). | |
add_filter( 'searchwp\query\mods', function( $mods ) { | |
global $wpdb; | |
$mod = new \SearchWP\Mod(); | |
$source = \SearchWP\Utils::get_post_type_source_name( 'post' ); | |
$mod->weight( $wpdb->prepare( "IF(s.source = %s, 9999999, 0)", $source ) ); | |
$mods[] = $mod; | |
return $mods; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment