Wordpress complex search query into pretty permalinks

121 Views Asked by At

I just wondering if there is a way to convert Wordpress complex search query into pretty permalinks.

From what I understand, there is a way to convert:

www.domain.com/?s=keyword into www.domain.com/search/keyword

However, what if you want to change search query complex like: http://domain.com/?s=+&location=jakarta&radius=1&distance=Miles&slider_search=1&etype=null into http://domain.com/search/event-jakarta

1

There are 1 best solutions below

0
On

yes you can add a rewrite rule using wordpress functions. It involves regex to identify the address given, and then go to the location.

add_action('init', 'add_rewrite_rule');
function add_rewrite_rule(){
   add_rewrite_rule('^event-jakarta?','index.php?is_sidebar_page=1&post_type=page','top');
}

you might need to play around with the regex a bit and the location. IF you google wp rewrite there is a good bit of information.