gregM-8
Support threads created in the last 30 days: 0
Favorite Forum Topics
This user has no favorite topics.
Forum Topics Created
Viewing topic 1 (of 1 total)
| Status | Topic | Supporter | Voices | Posts | Freshness |
|---|---|---|---|---|---|
|
Featured image (Media Library manager) as required field
Started by: gregM-8
in: Toolset Professional Support
Problem: Validate featured image in Toolset post form. Solution: You can try the cred_form_validate filter hook, like this: Put below PHP codes into your theme file "functions.php":
add_filter( 'cred_form_validate', 'require_featured_image_validation', 10, 2 );
function require_featured_image_validation( $data, $form_data ) {
$forms = array( 225 );
if( in_array( $form_data['id'], $forms ) ){
list($fields,$errors)=$data;
if (empty($fields['_featured_image']['value'])) {
$errors['_featured_image'] = __( 'Featured image is required', 'your-language-domain');
}
$data =array($fields,$errors);
}
return $data;
}
Relevant Documentation: https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate |
|
2 | 4 | 4 years, 10 months ago |
Viewing topic 1 (of 1 total)