Skip Navigation

[Resolved] Use URL parameter to control Query Filter

This thread is resolved. Here is a description of the problem and solution.

Problem:
Can we set the Query parameters in a View with a URL parameter?

Solution:
Yes, it is elaborated here:
https://toolset.com/documentation/user-guides/filtering-views-query-by-post-id/#value-set-by-url-parameter
(This is an example with ID queries, from https://toolset.com/documentation/user-guides/display-lists-of-posts-and-create-custom-searches/#filtering-queries)

You would create a View, then add a Query filter by whatever data you want to query, and choose "XY set by this URL parameter:".

Then you would insert this View to any page and link to it passing the URL parameter.

This is also what is used by default when you create front end searches and paginations.

This support ticket is created 5 years, 9 months 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 2 replies, has 2 voices.

Last updated by Ben 5 years, 9 months ago.

Assisted by: Beda.

Author
Posts
#1191235

Ben

Is it possible to use an URL parameter to control the Query Filter in a View?

#1191406

Yes, it is elaborated here:
https://toolset.com/documentation/user-guides/filtering-views-query-by-post-id/#value-set-by-url-parameter
(This is an example with ID queries, from https://toolset.com/documentation/user-guides/display-lists-of-posts-and-create-custom-searches/#filtering-queries)

You would create a View, then add a Query filter by whatever data you want to query, and choose "XY set by this URL parameter:".

Then you would insert this View to any page and link to it passing the URL parameter.

This is also what is used by default when you create front end searches and paginations.

#1191500

Ben

Thank you Beda that is perfect!