Skip Navigation

[Resolved] Filtering by URL parameter returns all records when url parameter is missing

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.

This topic contains 1 reply, has 2 voices.

Last updated by Jamal 1 month ago.

Assigned support staff: Jamal.

Author
Posts
#1703285

I am trying to: Use an URL parameter to pass a search parameter to a page with a view on it.

Link to a page where the issue can be seen: Any

I expected to see: No results because a match could not have satisfied the view filter section.

Instead, I got: All records found.

If the URL parameter is missing entirely, the search results return all records. This is wrong. The search should work the same way that all toolset filtered searches work, returning matching results within that context and the contents of the [not_found] context if there are no matches or the parameter does not exist. Anything else is illogical and a bug.

#1703491

Jamal
Supporter

Languages: English (English ) French (Fran├žais )

Timezone: Africa/Casablanca (GMT+01:00)

Hello and thank you for contacting the Toolset support.

If the URL parameter is not passed, it is expected to have all the results, because that is the match. Toolset is trying to filter by value(from URL param), but that value is not passed, so Toolset does not perform any filtering and we return all the results.

If you would like to have no results when the URL param is empty, check these previous replies, they provide a solution for the same use case:
- https://toolset.com/forums/topic/display-only-filtered-values/
- https://toolset.com/forums/topic/empty-initial-search-value/#post-592517

I hope this answers your question. Let me know if you have any doubts.