How to make location required in the search form

I want the buyer to be forced to enter a location when searching for a service from my homepage

Hi,

Please try this PHP snippet:

add_filter(
	'hivepress/v1/forms/listing_search',
	function( $form ) {
		$form['fields']['location']['required'] = true;

		return $form;
	},
	1000
);

Please note that you may require additional customizations in the future.

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