Request category filter shows only a fraction from the whole range of categories

Hi there,

Another issue was found on my website’s requests page. The category filter shows only 3 categories out of 16 (these also have subcategories). I tried cleaning the cache, deactivating cache on logged-in users, so on, and so forth…nothing worked.

I found 2 temporary solutions for this:

/*Displays all request categories and subcategories*/
add_filter(
	'hivepress/v1/forms/request_filter',
	function ( $form_args ) {
		if ( isset( $form_args['fields']['_category'] ) ) {
			$form_args['fields']['_category']['options']     = 'terms';
			$form_args['fields']['_category']['option_args'] = [ 'taxonomy' => 'hp_request_category' ];
		}

		return $form_args;

	},
	1000
);

/*Displays parent request categories*/
add_filter(
	'hivepress/v1/forms/request_filter',
	function ( $form_args ) {
		if ( isset( $form_args['fields']['_category'] ) ) {
			
			$form_args['fields']['_category']['options']     = 'terms';
			$form_args['fields']['_category']['option_args'] = [ 
				'taxonomy' => 'hp_request_category',
				'parent'   => 0 
			];
		}

		return $form_args;

	},
	1000 
);

The 2nd solution displays all 16 categories, but when I select one category and filter the requests, it doesn’t display the subcategories in the filter as the native filter does. Any ideas/ solutions to fix this behaviour?

Best regards,
Tomitzu

Hi,

Thank you for the details.
Could you please provide more info about the issue? Are there any other fields included in the filter form? Have you tried disabling all customizations (if any) to see if the issue still persists? Also, could you please let us know how the filter form works with your listings? Are all the categories displayed correctly?

There is no limit on displaying categories for requests, and on our side, the filter form shows all available categories. If there is a bug, we need all the steps to reproduce it so that we can fix it.

Hi there,

All requests posted on that page are generated through a custom add-on I made for HivePress Requests — I disabled it to check if the issue persists, and it does. Besides the category filter, I have also the map from Geolocation, the search bar with keywords, and Geolocation, and that’s all on that page. It looks quite awkward to me also, and I have no idea what the cause is. For the listing part, I still have to insert the subcategories (and there are a lot of them). After I manage to insert them, I’ll come back to you with an answer. Without the code above, I have three perfectly working categories :sweat_smile:

Thank you for your quick answer and interest in solving this issue.

Thank you for the details.

Have you tried to resave the hidden categories? Also please try to disable cache using this code snippet:

if ( ! defined( 'HP_CACHE' ) ) { 
    define( 'HP_CACHE', false );
}

If nothing resolves it, please send temporary WP access to support@hivepress.io with the link to this topic, and we’ll check it (please send only the link, without login and password). You can create a temporary access link using this plugin.

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