Skip to content


Search Redirector

Basically, Plugin causes WP to ignore any ?s= search requests, and instead, only performs searches on ?search= instead.

It does not modify the search forms, the theme will need to be changed to direct requests at the correct name. Could easily be placed in a themes functions.php instead too i believe.

< ?php
/*
Plugin Name: Search Redirector
Plugin URI: http://dd32.id.au/test-plugin/
Description: Redirects ?s= to ?search=
Version: 1.0
License: Public Domain; Do what ever you please
Author: DD32
Author URI: http://dd32.id.au/
*/

add_action('parse_request', 'search_request');
function search_request($wp){
$wp->query_vars['s'] = '';
if( !empty($wp->query_vars['search']) )
$wp->query_vars['s'] = $wp->query_vars['search'];
}

add_filter('query_vars', 'search_queryvars' );
function search_queryvars( $qvars ){
$qvars[] = 'search';
return $qvars;
}

?>

Rather simple really..


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.