Skip Navigation

[Resolved] Category filter is showing all categories instead of only categories with posts

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

Problem: I have a custom search View that is set to only display available options for each input. However, all categories are shown as options in a category filter, when some of those categories should not be displayed.

Solution: Our developers have issued a patch to solve this problem, and will include the fix in a future release of Blocks/Views.

This support ticket is created 3 years, 4 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 22 replies, has 2 voices.

Last updated by MarkT8581 3 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1875913

Tell us what you are trying to do?
Have my category filter drop-down select only show categories with posts that have it assigned.
Is there any documentation that you are following?
I've selected "Full page refresh when visitors click on the search button with input values auto-updating"
and I've got an additional Video-Type taxonomy assigned in the Taxonomy filter.
What is the link to your site?
hidden link

#1875995
Screen Shot 2020-12-14 at 11.39.24 AM.png

Hello, one of the options in Custom Search settings for a View turns on a feature where only those options that will produce results are available in the filters. However, it is an all-or-nothing feature, meaning that if you turn it on it applies to all the search fields and not just individual fields.

See the screenshot here, it shows where you can turn on "Show only available options for each input" in the Custom Search panel. Will this work for your needs?

#1876009
settings.png

It doesn't appear to be working correctly. I've got the following options checked and I'm still seeing categories with no posts assigned to them.

#1876065

Can you tell me one specific term that should not appear in the filter terms here?
hidden link

It's a bit confusing because the results are displayed on a different page when I click Submit, and the filter term options are different in those two pages.

#1876083

The category "Baptism" has no results.

On another note, I have 2 different pages because I have an offset with the latest episode on the top of the page and I don't want it showing the "Latest Episode" of the filter/search because it isn't technically the latest episode.

#1876091

OK.... sorry for the confusion... Now it appears to be working on the first page, but not on the results page. I'm confused. They are using the same view.

#1876185

There could be a bug, or it could be a configuration issue. Could I log in to wp-admin and see how the Views are implemented on these two pages? It will probably be the fastest way to determine the source of the problem. Private reply fields are enabled here.

#1876241

I don't see anything obviously set up incorrectly here. A similar setup in my local test site does not behave the same way when a View is split into different pages for filters and results, but I have a default theme active and no other 3rd-party plugins active. Do you have a staging site available where we can run tests like activating a default theme and disabling other plugins?

If not, is it possible for me to create a clone of the site using the Duplicator plugin?

#1876247

Here's a staging site you can use:
hidden link

#1876983

Okay in a quick test on the staging site, I have activated the default Twenty Twenty-One theme and deactivated all plugins except Types, Views, Maps and Forms. Now when I visit the results page, I do not see the "Baptism" option appear in the filters after a search, as seen here:
hidden link

So that indicates some interference from the theme or a 3rd-party plugin. I'll try to reactivate each component individually to narrow down the source of the conflict. Stand by and I'll give you another update shortly.

#1876991

Okay the conflict seems to occur when the Shortcode in Menus plugin is active. If I deactivate that plugin, the "Baptism" option no longer appears in the filters. I've left the plugin activated in staging for now, and I'd like to get your input. At first glance, I am unable to see where this plugin is used in menus to insert custom shortcodes. Is the plugin necessary? If not, can it be deactivated?

#1877021

Thank you for narrowing it down. I am using it in the slide-in menu. Maybe I'll look for alternatives since I'd rather not have a plugin that creates any kind of conflict with Toolset. Thank you for your help!

#1877201

OK. I've disabled the plugin and have found an alternative way to get the view at the end of the menu..... BUT now BOTH pages are showing all of the categories instead of just the categories with posts assigned. Back where we started.

#1877203

To be clear, I'm not sure if it is a conflict in the plugin, or an issue with some content inserted using this plugin. Regardless, if you want us to continue investigating please let me know. Otherwise we can close out here.

#1877215

Looks like we were typing at the same time... See my last post: #1877201

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.