Created
April 24, 2018 17:05
-
-
Save djrmom/8dcdb47d612de7e56d8250fb9976c0cb to your computer and use it in GitHub Desktop.
facetwp filter wp search form
This file contains hidden or 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 | |
| /** filters search form to replace the s input with your search facet - change fwp_search as needed | |
| ** and replace the default action with the page url of your custom search results page - change /search-results/ as needed | |
| ** may need adjusting if the search is already modified by another plugin or theme */ | |
| add_filter( 'get_search_form', function( $form ) { | |
| $form = str_replace( 'name="s"', 'name="fwp_search"', $form ); | |
| $form = preg_replace( '/action=".*"/', 'action="/search-results/"', $form ); | |
| return $form; | |
| } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment