Show sub category result after selecting a parent category

Hello, I have a search form in the Home page of my Wordpress site (based on Hivepress) which works well in the sense that it looks for all listings regardless of their category and lists those who contain the given keyword.
Now when the user uses the search form from category pages (/listing-category/) it does not show any answer because of the subcategories I’m using inside that catagory.
Technically the URL of the request form within the Home page comes with the field “&_category=” empty whereas the URL in the case of a category page comes with this field filled “&_category=28” (in my case)
is there any method by modifying the URL to shox the results by searching inside the subcategories?
thank you for your support

1 Like

Hi,

Please disable third-party plugins and customizations (if there are any) and check if this issue persists. If you use a caching plugin, ensure that caching is disabled for logged-in users. Also, please refresh permalinks How to refresh WordPress permalinks - HivePress Help Center. If this issue exists, please provide more details regarding this issue (e.g., your actions step by step with screenshots, etc.). This will help us to reproduce and resolve the issue faster.

Hi,
Thank you for your answer.
The issue is simple and is a priori linked to how the categories and subcategories are designed.
Assume you have declared a Catagory C1. And then you declare a SubCategory of C1 named S1.
If you launch the search for a listing (that existis at the level of S1) from the page of C1, you will not have any answer.
You should go to the page of S1 to get the answer.

Hope the issue is clearer now.
Thank you.

Hi,

We checked this issue from our side, and it seems okay. Please try to re-save any category and recheck the category search.

Hi,
Still have the same issue.
By the way, the following topic has already identified the issue but it did not get any answer.

Hi,

Please provide more details regarding this issue (e.g., your actions step by step with screenshots, etc.). This will help us to reproduce and resolve the issue faster.

Hi Andrii,
I’ve already explainded the issue and gave how to reproduce it. However, you can get even more details hereafter.
-assume that you have a web site with listings of second-hand cars.
-You define a category called SUV
-Then you define two subcategories : BMW SUV & Nissan SUV.
-NB : while defining the category SUV you check the box : display subcategories rather than listings.
-Then you create one listing in the subcategory BMW SUV with the title “beautiful X6” and another listing in the subcategory Nissan SUV with “beautiful qashqai”

Now you go to the SUV category page, you put “beautiful” in the search bar and you validate. You will not get any answer displayed.
If you go to the subcategory BMW SUV for example and do the same thing, you have the “beautiful X6” listing published.
If you go the Home page and use the search bar you will get the two listings displayed.

Hope the issue is clearer now.
Thanks,

Hi,

If you have enabled the display subcategories instead of the listings feature for the SUV category, then whatever you search for in this category it will not show listings, which is the point of this feature, but will show subcategories until you select one of the subcategories. This option is used when search filters conflict at the category level, and you need to force the user to select a category first.

Hi,
Yes I understand. The problem is that that it is not intuitive for the user to select au sub-category to have the results. Most of the users think there is no results corresponding to the research.
That’s why I’m trying to modify the code in order to show the results or even remove the search bar in the catogery page.
Could you please help me achive one of these two options?

Thanks,

Hi,

Unfortunately, there is no other solution than to disable this function, because it will work as described in the option. If you don’t have mixed search filters in a subcategory, then after disabling this feature, users will be able to search at this level (parent category) without selecting a subcategory.

Hi,
I need to show subcategories in order to be able to highlight listings for each subcategory (my subcategories are geolocalized). This is the only solution i’ve found to highlight listings in each region.
I believe it iwould be possible to enforce the research in all the website like in the search bar in the Home page. I prefer to have this rather than not showing anything.
Also, there is another option which conists in removing the search bar in the catagory page. Could you please help me in implemeting one of those two options?
Thanks.

Hi,

We recommend highlighting the category as a block on the landing page or on the main page. Also, if you have this feature enabled, subcategories are still displayed on the left side of the sidebar filter.

sorry, but I don’t understand the first part of your answer. Could you please explain more? and how it helps mitigating the issue?
thank you.

1 Like

Hi,

No, unfortunately there’s no way to keep both subcategories and listings on a page if you enable the “Display subcategories instead of listings” option. This option has a different purpose, it enforces selecting a subcategory before searching listings on the current category level, so it shows subcategories until selected. But, you can still show any categories or subcategories on other pages (e.g. Home) using the Listing Categories block in the editor.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.