Skip to content

Instantly share code, notes, and snippets.

@xardit
Created July 4, 2023 12:26
Show Gist options
  • Save xardit/64d36fa2832607395d81271f8ba6b051 to your computer and use it in GitHub Desktop.
Save xardit/64d36fa2832607395d81271f8ba6b051 to your computer and use it in GitHub Desktop.
WP Custom Upload MIME types
<?php
function my_custom_mime_types( $mimes ) {
// New allowed mime types.
$mimes['svg'] = 'image/svg+xml';
$mimes['svgz'] = 'image/svg+xml';
$mimes['doc'] = 'application/msword';
// Optional. Remove a mime type.
unset( $mimes['exe'] );
return $mimes;
}
add_filter( 'upload_mimes', 'my_custom_mime_types' );
@xardit
Copy link
Author

xardit commented Jul 4, 2023

Or to allow unfiltered uploads for any type, add to functions:

define( 'ALLOW_UNFILTERED_UPLOADS', true );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment