Hi Tom,
Looks like /search/ is default in wordpress , other keywords not working and redirect to homepage or 404 page, if i change code wp_redirect( site_url() . ‘/search/’ ….
this code in functions.php
/* nice search link
------------------------------------*/
function true_rewrite_search_results_permalink() {
global $wp_rewrite;
if ( !isset( $wp_rewrite ) || !is_object( $wp_rewrite ) || !$wp_rewrite->using_permalinks() )
return;
if ( is_search() && !is_admin() && strpos( $_SERVER['REQUEST_URI'], "/search/") === false && ! empty( $_GET['s'] ) ) {
wp_redirect( site_url() . '/search/' . urlencode( get_query_var( 's' ) ) );
exit;
}
}
add_action( 'template_redirect', 'true_rewrite_search_results_permalink' );
//for special characters, cyrillic
function true_urldecode_s($query) {
if (is_search()) {
$query->query_vars['s'] = urldecode( $query->query_vars['s'] );
}
return $query;
}
add_filter('parse_query', 'true_urldecode_s');
and for BuddyPress in bp-custom.php
define( 'BP_SEARCH_SLUG', 'searchresults' );
this is why i try to code with custom variable