Make opening hours required

I want to make opening hours required in the listing submission form , kindly help

Hi,

Please use this PHP snippet (How to add custom code snippets - HivePress Help Center):

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

		return $form;
	},
	1000
);

​I hope this is helpful to you.

The snippet do make it required , but even after filling the opening hour field the form refuse to submit and it give an error message saying that opening hours is required

Hi,

Please use this PHP snippet:

add_filter(
	'hivepress/v1/models/listing',
	function( $model ) {
		if ( isset( $model['fields']['opening_hours'] ) ) {
			$model['fields']['opening_hours']['required'] = true;
		}

		return $model;
	},
	1000
);

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