Changing Request Category dropdown field to an autocomplete text search field

Hi HivePress Support Team,

I am using the TaskHive theme along with the HivePress Requests extension.

Right now, on my Request forms, the Category selection field renders as a standard single-selection dropdown menu with a default dash (-). This creates a clumsy user experience, because clicking the dash forces the system to list all core services/categories in a massive dropdown.

Instead of this single-select dropdown and the empty dash, I want this field to display as an interactive, searchable text field (an autocomplete input box) where users can type to filter and find their service category or sub-category immediately.

Could you please provide the exact code snippet or hook required to change the _category taxonomy field from a standard dropdown to a searchable autocomplete text box specifically for HivePress Requests?

Thank you for your time and assistance!

Hi,

The category selector works as a multi-step dropdown. If you have multi-level categories, it first displays the top-level categories, and then users can navigate to the next level by clicking on a category. This generally provides a cleaner user experience when working with hierarchical categories.

If you mean that there are many top-level categories, the search field should automatically appear when there are 20 or more results, allowing users to search within the available categories.

If the search field doesn’t appear in your case, or if you’d like it to appear with fewer than 20 results, you can add the following snippet using a code snippets plugin. This will make the search field appear as soon as there is at least one result.

add_filter(
	'hivepress/v1/forms/request_submit',
	function( $form ) {
		if ( isset( $form['fields']['categories'] ) ) {
			$form['fields']['categories']['attributes']['data-options'] = wp_json_encode(
				[
					'minimumResultsForSearch' => 1,
				]
			);
		}
		return $form;
	},
	1000
);

Hope this helps