Skip Navigation

[Resolved] Filter just a subset of all CPT through GUI, excluding some by default

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

Problem: I have a custom search View with several different search criteria. One of those filters should be predefined, and I do not want the User to be able to change that filter. It should be set in the backend and no input should be provided on the front-end to change the filter.

Solution: In the View editor screen Search and Pagination panel, remove the filter control that corresponds to the filter you want to predefine. Then in the Query Filter panel, adjust the filter to predefine the value instead of responding to a URL parameter. If you cannot see the Query Filter panel, scroll to the top right corner and click "Screen Options." You can activate the panel here.

This support ticket is created 5 years, 3 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by jensF-3 5 years, 2 months ago.

Assisted by: Christian Cox.

Author
Posts
#1516419

Tell us what you are trying to do?

Building a custom search. The filters are working by now.
All the posts have some custom taxonomies. One (categorical) is named: "usecase" and has just two categories "sale" & "rent".

Now I try to achieve a view, which shows all posts whose term(s) for category includes "sale".
When I add the filter to my already configured custom search, then I do have the field as an option to the user. But I need a way to select the sum of posts including the term "sale" beforehand. Then in the next step the user can use the filter to work his way through the results.

Is there any documentation that you are following?

Tried a lot, but I'm confused and after my last experience searching the right way for days just to learn, that's a bug in Toolset, I now write here after just two hours of fiddeling....

Is there a similar example that we can see?

at the moment not.

What is the link to your site?

Local dev

#1516727

Hello, are you saying you would like to completely remove the front-end filter that allows the User to choose "usecase" filter options and filter by the "sale" term, OR would you like to keep the front-end filter visible but pre-select "sale" as a filter option, allowing the User to modify that filter if they want?

If you prefer the first option, then you can remove the taxonomy filter control from the Search and Pagination panel of your View, and set the value manually in the Query Filter panel. If you cannot see the Query Filter panel, scroll up to the top right corner of the screen and click "Screen Options" to activate it. You can edit the existing taxonomy filter to match a specific term instead of responding to a URL parameter.

If you prefer the second option, then the only way to preselect a custom search filter and allow the User to modify it like this is to set the value using a URL parameter. For example, if the custom search View is on a page at https://yoursite.com/custom-search-page/ then if you want to preselect the "sale" filter option you would have to link to that page with the URL parameter already applied, something like https://yoursite.com/custom-search-page/?wpv-usecase=sale
Your URL parameter and term slugs may be different, this is just a general overview of how it would work.

Let me know if you have questions about either of these approaches.

#1516983

Hey Christian,

thanks a lot for your help. It's the first usecase you mentioned. I now did find the Query Filter, it wasn't visible as you suggested. There I added the filter, but it doesn't seem to have an effect on the actual subset of posts.
But anyway, I'll have a deeper look into that the next days and then I'll come back with some more detailed informations. Tomorrow I won't be able to work on the project.

Thanks again!

#1518865

Okay feel free to post back if you are stuck, I'll be glad to take a closer look. I'll stand by for your update.

#1523409

My issue is resolved now. Thank you!