• Hi, how do I change the search query from “?s=” to “?q=”.

    I tried one solution from a site but it is not working.

    add_filter('init', function(){
        global $wp;
    
        $wp->add_query_var( 'q' );
        $wp->remove_query_var( 's' );
    } );
    
    add_filter( 'request', function( $request ){
        if ( isset( $_REQUEST['q'] ) ){
            $request['s'] = $_REQUEST['q'];
        }
    
        return $request;
    } );
    • This topic was modified 2 years, 4 months ago by samuraixx.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Change Search Query from “s” to “q”’ is closed to new replies.