Allow vendors to upload only specific file types in EDD Frontend Submissions

Easy Digital Downloads - Front-End Submissions - Allow only specific mime types upload

Frontend Submissions is an add-on that turns Easy Digital Downloads powered WordPress website into a complete multi-vendor marketplace. Based on your marketplace, you may need to restrict the certain file type uploads or allow specific file types upload only for your vendors.

I am sharing a code snippet that I just have written, and implemented on one of my client’s EDD FES website. Inserting it into WordPress theme’s functions.php will restrict vendors to upload any other file types and allow only zip file type upload.

// FES form field name : Prices and Files
add_filter( 'upload_mimes', 'dcg_restrict_mime_types', 1, 1 );
function dcg_restrict_mime_types( $mime_types )
$user = wp_get_current_user(); // get the current user
// if user is shop vendor or a shop manager
if ( in_array( 'shop_vendor', (array) $user->roles ) || in_array( 'shop_manager', (array) $user->roles ) ) {
// add the mime types you want to allow to upload
$mime_types = array(
'zip' => 'application/zip',
// Use unset to remove specific mime types uploads.
// unset( $mime_types['xls'] ); // Remove .xls extension
// unset( $mime_types['xlsx'] ); // Remove .xlsx extension
// unset( $mime_types['docx'] ); // Remove .docx extension
return $mime_types;

view raw
hosted with ❤ by GitHub

Have you any better solutions? I would love to read your comments.

Leave a Reply

Please note: These tutorials are meant to be helpful, but please note that I can not and will not be able to help with any implementations or modifications.

tl;dr If you do not understand it, hire me to do it.