Continue reading Redirecting email searches to the login page

Redirecting email searches to the login page

A client asked for a solution to redirect all searches for email addresses to the login page – perhaps someone is constantly using the search field when they’re actually looking for the login. This is something that will be easier in Relevanssi Premium version 2.16, when the Redirects tool will accept regular expressions, but it’s not…

Read more Redirecting email searches to the login page 0 Comment on Redirecting email searches to the login page
Continue reading Auto-redirecting with one search result

Auto-redirecting with one search result

If you want to auto-direct the user directly to the result if there’s just one result for the search, that’s quite easy. Just add the following code to your theme functions.php: add_action(’template_redirect’, ‘one_match_redirect’); function one_match_redirect() { if (is_search()) { global $wp_query; if ($wp_query->post_count == 1) { wp_redirect( get_permalink( $wp_query->posts[’0’]->ID ) ); exit(); } } }add_action(‘template_redirect’,…

Read more Auto-redirecting with one search result 12 Comments on Auto-redirecting with one search result