Skip to content

Instantly share code, notes, and snippets.

@jchristopher jchristopher/functions.php
Last active Jul 29, 2019

What would you like to do?
Change the WordPress search query parameter from 's' to something else
add_filter('init', function(){
global $wp;
$wp->add_query_var( 'search_query' );
$wp->remove_query_var( 's' );
} );
add_filter( 'request', function( $request ){
if ( isset( $_REQUEST['search_query'] ) ){
$request['s'] = $_REQUEST['search_query'];
return $request;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.