Note: You are viewing the documentation for Version 3View Version 4 Docs

Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP's many hooks, get support

Available since: 1.3.6

searchwp_short_circuit

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:

<?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:

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

Parameters

Parameter Type Description
$short_circuit Boolean

Whether SearchWP will short circuit

$searchwp Object

The SearchWP instance

Fix keyword search on your site. No coding required!

Now you can utilize all of the content that's gone unrecognized by native WordPress keyword search instantly with SearchWP

Get SearchWP