Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Created September 24, 2020 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugin-republic/f9e0d03e0fba543c3cf478a31321e0e0 to your computer and use it in GitHub Desktop.
Save plugin-republic/f9e0d03e0fba543c3cf478a31321e0e0 to your computer and use it in GitHub Desktop.
<?php
/**
*
*/
function new_prefix_pewc_get_permitted_mimes( $permitted_mimes ) {
$permitted_mimes['pdf'] = "application/pdf";
$permitted_mimes['svg'] = 'image/svg+xml'; //Adding svg extension
$permitted_mimes['eps'] = 'image/x-eps'; //Adding photoshop files
$permitted_mimes['ai'] = 'application/postscript'; //Adding photoshop files
$permitted_mimes['psd'] = 'image/vnd.adobe.photoshop'; //Adding photoshop files
$permitted_mimes['xd'] = 'application/zip'; //Adding photoshop files
$permitted_mimes['ps'] = 'application/postscript'; //Adding photoshop files
$permitted_mimes['xls'] = 'application/vnd.ms-excel'; // excel file
$permitted_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml'; // excel file
$permitted_mimes['csv'] = 'text/csv'; // csv file
return $permitted_mimes;
}
add_filter( 'pewc_permitted_mimes', 'new_prefix_pewc_get_permitted_mimes' );
function new_prefix_mime_types($mime_types){
$mime_types['svg'] = 'image/svg+xml'; //Adding svg extension
$mime_types['eps'] = 'image/x-eps'; //Adding photoshop files
$mime_types['ai'] = 'application/postscript'; //Adding photoshop files
$mime_types['psd'] = 'image/vnd.adobe.photoshop'; //Adding photoshop files
$mime_types['xd'] = 'application/zip'; //Adding photoshop files
$mime_types['ps'] = 'application/postscript'; //Adding photoshop files
$mime_types['xls'] = 'application/vnd.ms-excel'; // excel file
$mime_types['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml'; // excel file
$mime_types['csv'] = 'text/csv'; // csv file
return $mime_types;
}
add_filter('upload_mimes', 'new_prefix_mime_types', 1, 1 );
/**********************************************************
* Additionally, you can install the free plugin, WP Extra File Types:
* https://en-gb.wordpress.org/plugins/wp-extra-file-types/
* And enable various file types as required
**********************************************************/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment