Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created April 22, 2020 18:44
Show Gist options
  • Save jchristopher/21bb196c8704664576de5a75b3b4d104 to your computer and use it in GitHub Desktop.
Save jchristopher/21bb196c8704664576de5a75b3b4d104 to your computer and use it in GitHub Desktop.
Add relevance weight to a single SearchWP Source
<?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