This Documentation is for SearchWP Version 3

Available since: 1.3.6


View Parameters »

If you are working on a very custom project and want to prevent SearchWP from injecting it’s own search results, you can do so by telling it to short circuit. Add the following to your theme’s functions.php:

add_filter( 'searchwp_short_circuit', '__return_true' );
view raw gistfile1.php hosted with ❤ by GitHub

With that filter in place SearchWP will not inject search results into the native WordPress search. You can then do the following to retrieve search results from SearchWP and do what you’d like with them:

$results = SWP()->search( 'default', 'my search terms' );
// returns an array of post objects
view raw gistfile1.php hosted with ❤ by GitHub


Parameter Type Description
$short_circuit Boolean

Whether SearchWP will short circuit

$searchwp Object

The SearchWP instance