Search log doubles with url rewrite
-
Hi, lovely plugin!
I’m using this snippet to rewrite my search URLs to something more tasty:
function search_url_rewrite_rule() { if ( is_search() && !empty($_GET['s'])) { wp_redirect(home_url("/search/") . urlencode(get_query_var('s'))); exit(); } } add_action('template_redirect', 'search_url_rewrite_rule');
I’m also logging user queries. The problem I’m having is that with this rewrite in place, each time a user makes a query, 2 identical queries get logged. Without the rewrite in place, only 1 query gets logged (i.e. correct behaviour).
Can you suggest a way I can use my redirect and log the correct number of queries?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Search log doubles with url rewrite’ is closed to new replies.