This thread is resolved. Here is a description of the problem and solution.
Problem:
How to filter taxonomy filter dropdown options and display specific terms
Solution:
There is no way to filter the term options added to taxonomy filter select box using views but a workaround would be:
You need to use WordPress standard hook "pre_get_terms" in order to filter the taxonomy query.
We have a couple of sites using Toolset for holiday properties just in specific areas, works great.
We now need to create one 'master' site, this has all the main areas and also it's sub areas....this we can't work out something.
In our main search bar for example (this on all our main landing pages) hidden link
This sends results to a Search Results Page.
However we only wish this to have the main destination pages (in red) included in the drop down....not all the sub pages under.
How do we exclude pages? I see no filter option in the view and have tried various things however because pages can't have categories or be defined in any way, I can see no way of including and excluding what we need 'for pages' in search options for Toolset.
Hello. Thank you for contacting the Toolset support.
Do you mean that you want to display the search form with the only pages which you marked with red box and those only pages should display the search box and on other pages it should not display search box?
Yes, for certain Views where we use the search bar shown in the link, we only wish to have the 'main' pages show up here....we have so many sub pages the drop down will be too, too long.
There is no way to add the post links to the dropdowns.
As I understand, you want to display the direct link of those are posts but maybe you misunderstood how view works.
It looks like with your setup, the area is setup as a custom field or taxonomy. The view will display the dropdown options for only those area for which the results are available. And when you search the view obviously it will redirect you on the search result page rather on those specific area pages. This is expected.
If you want to display link of those area posts, you need to create a view that display those are links.
You can not make a dropdown but as I said you can create a view that displays the links. Maybe you can create a view that display those post links and display the view as sidebar using view's widget?
I understand but as stated, even if those are the categories, there is no way to exclude specific terms from frontend taxonomy term filter. As there is no option to exclude terms.
what if you create a term field like "is Main page category?" using checkbox type field and checkmark the checkbox for the terms where you want.
And then later, you need to add the custom hook to filter your taxonomy query results. Can you setup the term custom field as I said above and setup the terms which you want to display on main page and send me access details and problem URL where you want to display those terms.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
What I've said and what you have done is totally different thing. I've asked to create a custom TERM field not custom post field.
However - with the link you shared: hidden link
- I can see with the destination frontend dropdown filter, I can only see few terms. You still want to remove few terms from that destination dropdown? If yes, what are those which you want to remove.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
When I say remove, I do not mean to remove actually.
Can you please answer my question here:
However - with the link you shared: hidden link
- I can see with the destination frontend dropdown filter, I can only see a few terms. You still want to remove/hide few terms from that destination dropdown? If yes, what are those which you want to remove/hide from the dropdown.