set specific url for search results

Home Forums Product Support Forums Ajax Search Pro for WordPress Support set specific url for search results

This topic contains 2 replies, has 2 voices, and was last updated by thefoxlife83 thefoxlife83 3 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #32153

    Hi there!

    I’m hoping you can help me, although I’m beginning to think that what I’m trying to accomplish is a hoop dream.

    I want to create a search that will deliver specific results. We have a “Destinations” page and we want people to be able to enter a country name into the search bar and go to articles about that country. BUT. In some cases, we want people to be directed to a specific URL and not a search results page.

    Is this something that can be accomplished with Search Pro? Is it something that can be accomplished at all? I started with trying to create a dropdown/filter select list but couldn’t figure out how to set the option values as hyperlinks.

    Looking forward to any configuration advice you can offer!

    Ernest Marcinko
    Ernest Marcinko


    Actually, there might be a programmatcial solution, but it is definitely not a simple one. In this knowledge base, a frontend hook is presented, which allows changing the magnifier and return button redirection URLs programmatically.
    This could be used for this purpose. You could basically check the phrase, and then change the URL according to that.

    Maybe starting with something like this:

    add_action('wp_footer', 'asp_change_redirect_uri');
    function asp_change_redirect_uri() {
    		wp.hooks.addFilter('asp_redirect_url', 'asp', function(url, id, instance){
    			var redirect = url;
    			var urls = {
    				'phrase 1' : '',
    				'phrase 2' : '',
    				'phrase 3' : ''
    			var phrase = $('.asp_m_' + id + '_' + instance).find('input.orig').val();
    			$.each(urls, function(s, uri) {
    				if (s == phrase) {
    					redirect = uri;
    			return redirect;
    		}, 10);
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    I’ll give it a shot – thanks!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.