This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Triggering a search by url with additional term filters

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Triggering a search by url with additional term filters Reply To: Triggering a search by url with additional term filters

#18776
Ernest MarcinkoErnest Marcinko
Keymaster

Hi David,

Thank you very much for your kind words!

For the custom field filters it is now possible, the taxonomy term part is not ready yet. However there is an API call, that can give you the ‘state URL’ of the current search, which is basically what you are looking for. The downside of this is, that it cannot be easily modified as it is base64 encoded. This state URL can be requested via the javascript console.

To get a URL to a specific search state, do the following:
1. Set up the search filters as you need them. In this example I have selected the following filters: https://i.imgur.com/914TuSP.png

2. Open your developer console. In Google Chrome browsers you need to hit the F12 button once, and a window will open on the bottom of the browser window. Make sure to navigate to the ‘console’ tab there, it should look like this: https://i.imgur.com/H9a2hGW.png

3. Now, enter the following code to the console input:

[code]ASP.api(1, 1, ‘getStateURL’);[/code]

..and then hit the enter key to execute it. It should return something like this: https://i.imgur.com/W72RSQA.png

4. That is the state URL of the current search filters and input. You can right click to copy it. Using that URL will open the same exact page with these exact filters selected.
In my case this URL was exactly this.

You can use this method to generate any states, then copy the URLs. If you visit these URLs the search is re-created with the filters and the search phrase chosen.

I hope this helps 🙂