Hi,
I had made the tags extension a required attribute when vendors submit a listing, but after changing it’s order - I’ve moved it near the top - it’s lost it’s required status and is now an optional attribute again.
This is the code snippet I’ve used to change the order:
add_filter(
'hivepress/v1/forms/listing_update',
function( $form ) {
$form['fields']['tags']['_order'] = 75;
return $form;
}
);
And this is the one I used to make it required:
add_filter(
'hivepress/v1/models/listing/attributes',
function( $attributes ) {
if ( isset( $attributes['tags'] ) ) {
$attributes['tags']['edit_field'] = array_merge(
$attributes['tags']['edit_field'],
[
'required' => true,
'max_values' => 10,
]
);
}
return $attributes;
},
1000
);