Skip Navigation

[Resolved] A taxonomy filter doesn’t show a taxonomy term choice unless there are 2+ posts

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

Problem:
A view's taxonomy filter does not display some terms until the user adds more than one post to the term.

Solution:
The view displays the media files, which do not have the status set to publish. In that case, Toolset will search for their parent post status. And the status should be "publish" or "private".

The terms that the user talks about were including only one post, and that post did not have the status "publish" or "private" and it did not have a parent post either.

The media files need to be attached to a post, or the view needs to query media files in all statuses.

This support ticket is created 3 years 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
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 5 replies, has 2 voices.

Last updated by scottL-3 3 years ago.

Assisted by: Jamal.

Author
Posts
#2100325

I am trying to:

Using a Toolset custom taxonomy as an AJAX search filter. It works fine for terms that have two or more posts. If a term has only one post, it does not show as a search option. Might this have broken with the fixes that were needed recently to get the search to only show terms that have results?

Link to a page where the issue can be seen:
hidden link

In the Applications taxonomy there should be a term called "Brick and Stone" but it does not appear unless we add a second media item to the category.

I expected to see:
Brick and Stone as a search choice for the Applications taxonomy

Instead, I got:
Brick and Stone does not show unless it has at least 2 matches

#2100515

Jamal
Supporter

Languages: English (English ) French (Français )

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

Hello and thank you for contacting the Toolset support.

I tried to reproduce this issue with a view that is built with the block editor, and I could not. You can check this page hidden link
The "Brick and Stone" category has only one post. You can log into my test website with the following URL hidden link

I have also tried it with a view built with the legacy editor and the issue is not reproducible. Check it here hidden link

So, this issue only appears on your website, even though I could not see it. The website is restricted. Check this screenshot hidden link
Maybe it is caused by a compatibility conflict with another component(theme/plugin). Please check if it appears when:
- Only Toolset plugins are activated. It will tell us if there is an interaction issue with another plugin.
- The theme is set to a WordPress default like Twenty-Twenty. It will tell us if there is an interaction issue with your theme.
If the problem disappears, start activating one at a time to track where the incompatibility is produced.

If this does not help find out the cause of this issue, we'll need to take a copy of your website to debug it locally. Let us know if that's fine with you.

#2100599

What country are you in? I can enable your country in Wordfence.

We cannot disable all other plugins and switch to a default theme on this site. The site has been running fine for years and has many plugins and customizations that depend on the theme (GeneratePress which is adding scripts via its elements feature).

I disabled as many plugins as I could on our staging site and the problem still occurs. I can give you admin access and even ftp access to the staging site much more easily than I can give you a copy of the site. Would that work for debugging the issue further?

This is a legacy Views built View and not one made with blocks. It may be significant that it is a View of Media library items, not custom posts or regular posts or pages.

#2100609

Jamal
Supporter

Languages: English (English ) French (Français )

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

Yes, please! Provide WordPress and FTP access to your website and I'll check it further. I am located in Morocco.

However, if I don't find the cause of the issue, I'll need to take a light copy of your website and debug it locally. If I also, could not find a solution, I can't escalate the case to our 2nd Tier without providing a copy of the website.

To take the copy, I'll use the Duplicator plugin, or the All In One Migration plugin.

Your next reply will be private to let you share credentials to the staging site safely.

#2100689

Jamal
Supporter

Languages: English (English ) French (Français )

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

The view is configured to display only the filter options that will produce the results. The term "Brick and Stone" does have a Media post assigned to it. But that post is not returned by the view, because it does not have the status "publish" or "private" and it is not linked to any post that has the status "publish" or "private". As you can see in the underlying query of the view. Check this screenshot hidden link

So, my question is, would you like to display all the photos on this view? If yes, you can add a query filter to the view on the post status, and choose any post status. Otherwise, you will have to attach the media post on this term to any published or private post(post, or page, or a custom post type)

I hope this helps. Let me know if you have any questions.

#2100729

I see, yes, since there is no "post" for the filter to apply to if the image is not attached to a post. Makes sense. I need the filter to only show options that produce results so I need to keep it the way it is now. I will tell the customer to attach images to posts if they want them to work in the search view for photos.

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