Removing the optional tag

How do you remove the “optional” tag when making a listing?

1 Like

Please try this PHP snippet for the images field

add_filter(
	'hivepress/v1/forms/listing_update/errors',
	function( $errors, $form ) {
		$listing = $form->get_model();

		if ( $listing && ! $listing->get_image__id() ) {
			$errors[] = 'Please upload at least one image.';
		}

		return $errors;
	},
	1000,
	2
);

add_filter(
	'hivepress/v1/forms/listing_update',
	function( $form ) {
		$form['fields']['images']['statuses'] = ['optional'=>null];

		return $form;
	},
	1000,
	2
);

Please try this PHP snippet for other fields in this form Make the purchase note or booking note required #hivepress #marketplace #bookings · GitHub

Please just change purchase_note on the attribute slug by your requirements

it worked!

i would also want to make the this from “requires review” to “optional” instead.

Thanks for your help!

Please edit this attribute and un-check the Moderated option for it, otherwise this would require customizations (overriding the attribute status labels with a custom snippet).

Thanks! :slight_smile:

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