Skip Navigation

[Resolved] Keep search parameters when showing result on other pager

This support ticket is created 5 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 5 years ago.

Assisted by: Waqar.

Author
Posts
#1643593

I have a search for with some search filters (taxonomy checkboxes). I want to have the results show on another result page. This works fine, but when I return to the search page it does not remember the selected search criteria.

If I change the setup to have both search form and results on the same page it works, but I do not want this.

How can a make it work with separate search form and results?

Hope you can help

#1646149

Hi,

Thank you for contacting us and I'd be happy to assist.

To create a "Back" link on your view's search results page, that keeps the selected search form's filters intact, you can follow these steps:

1. You'll need a custom shortcode, that can get the URL parameters from the current page's URL.

For example:


add_shortcode('show_current_url_query', 'show_current_url_query_func');
function show_current_url_query_func() {
	return $_SERVER['QUERY_STRING'];
}

The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through active theme's "functions.php" file.

2. Next, on your search results page, you can include a "Back" link that uses this shortcode, like this:


<a href="[wpv-post-url id='123']?[show_current_url_query]">Back</a>

Note: You'll replace "123" with the actual ID of your page with the search form.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar