Created
February 13, 2025 17:21
-
-
Save hivepress/bb5c7a281ebee8cbd94c540122e4211a to your computer and use it in GitHub Desktop.
Require uploading at least one image for requests #hivepress #requests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( | |
'hivepress/v1/forms/request_update/errors', | |
function( $errors, $form ) { | |
$request = $form->get_model(); | |
if ( $request && ! $request->get_images__id() ) { | |
$errors[] = 'Please upload at least one image.'; | |
} | |
return $errors; | |
}, | |
100, | |
2 | |
); | |
add_filter( | |
'hivepress/v1/forms/request_update', | |
function( $form ) { | |
$form['fields']['images']['statuses']['optional'] = null; | |
return $form; | |
}, | |
1000 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment