By default a Types image custom field added to a CRED form will accept the following file types to upload:
bmp|gif|ico|jpeg|jpg|png|svg|webp
When the form markup is printed the data-attribute used to declare the list of allowable extensions passes through a filter which can be used to modify it, provided you have the CRED form id, which in the example code is 107.
Add the following to functions.php
add_filter('wptoolset_forms_field_js_validation_data_cred_form_107_1', 'set_image_types', 99, 1); function set_image_types( $params ) { if ( isset($params['extension']) ) { $params['extension']['args'][0] = "jpeg|jpg|png"; $params['extension']['message'] = "You can only add jpeg, jpg, or png images"; } return $params; }
You can customise the list of allowed file extensions, and the message.
Note that you may run into issues if you try to add a file extension which WordPress itself restricts (not tested).
Support Thread Example
Let us know if this snippet is not working for you:
This snippet doesn’t work