After users upload their listing pictures to the front end editor, they are not able to delete a picture, as the little “x” would not appear. They are only able to drag and re-order those pictures they uploaded.
Hi,
We checked this issue from our side, and it seems okay. Please disable third-party plugins and customizations (if there are any) and check if this issue persists. If you use a caching plugin, make sure that caching is disabled for logged-in users. If this issue exists, please provide more details (e.g., your actions step by step with screenshots, etc.). This will help us to reproduce and resolve the issue faster.
I found the issue:
In the plugin Code Snippets I added the following:
// Required and limit the number of images in submit form
add_filter(
'hivepress/v1/models/listing',
function( $model ) {
$model['fields']['images']['required'] = true;
$model['fields']['images']['max_files'] = 10;
return $model;
}
);
My intention in using this was to require users to have images and ensure they don’t upload more than 10 images. However, this made the “x” sign disappear. Could you let me know what I can do to keep this snippet but also keep the “x” sign?
Thanks
Hi,
Please try to use this PHP snippet:
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;
},
100,
2
);
add_filter(
'hivepress/v1/forms/listing_update',
function( $form ) {
$form['fields']['images']['statuses']['optional'] = null;
return $form;
},
1000
);
I hope this information proves useful to you
Seems to be working now! Thank you!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.