Remove location field from submit listing form

Hi there,
I have synched my location attribute, and now want to hide the location field on the listing submit form.
I tried the snippet below, but it still shows up on the listing submit form?

//Remove Location Field
add_filter(
	'hivepress/v1/forms/listing_update',
	function( $form ) {
		unset( $form['fields']['location'] );
		
		return $form;
	},
	1000
);

add_filter(
	'hivepress/v1/forms/listing_submit',
	function( $form ) {
		unset( $form['fields']['location'] );
		
		return $form;
	},
	1000
);

add_filter(
	'hivepress/v1/models/listing',
	function( $model ) {
		$model['fields']['location']['required'] = false;

		return $model;
	},
	1000
);

Hi,

Please use this PHP snippet:

add_filter(
	'hivepress/v1/models/listing/attributes',
	function( $attributes ) {
		if ( isset($attributes['location']) ) {
			$attributes['location']['editable'] = false;
		}

		return $attributes;
	}
);

Thanks!

where to add this code

Hi,

Please check this doc: How to add custom code snippets - HivePress Help Center

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