Created
March 26, 2020 16:53
-
-
Save jchristopher/0f7aa98ab1dd814e21c185f66d3a9da9 to your computer and use it in GitHub Desktop.
Prevent SearchWP from providing search results when a specific URL parameter exists
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 | |
// Prevent SearchWP from providing search results when a specific URL parameter exists. | |
add_filter( 'searchwp\native\short_circuit', function( $enabled, $query ) { | |
// If 'my-query-var' is set, short circuit SearchWP. | |
if ( isset( $_GET['my-query-var'] ) ) { | |
return true; | |
} | |
return $enabled; | |
}, 20, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment