Skip to content

Instantly share code, notes, and snippets.

@petersplugins
Created January 2, 2018 11:08
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 petersplugins/e45474b26afdd53132d5157cd13e4329 to your computer and use it in GitHub Desktop.
Save petersplugins/e45474b26afdd53132d5157cd13e4329 to your computer and use it in GitHub Desktop.
<?php
// This code snippet adds additional file types allowed to upload
// Add a custom function to add needed mime types
add_filter( 'upload_mimes', 'add_mime_types' );
function add_mime_types( $mime_types ) {
// add file extensions .svg, .webp, .ai, .eps, .ep, .xml
// more file extensions can be added just the same
// for each file type the MIME type is needed
return array_merge( $mime_types, array(
'svg' => 'image/svg+xml',
'webp' => 'image/webp',
'ai|eps|ps' => 'application/postscript',
'xml' => 'text/xml'
) );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment