Moo Digital Custom MIME Types
A lightweight WordPress plugin that enables uploading of custom file types (EPUB, SVG, etc.) to the WordPress media library with built-in security features.
by Moo Digital · github.com/moo-digital/moo-digital-custom-mime-types · website
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/moo-digital/moo-digital-custom-mime-types/archive/refs/heads/main.zipReadme
Moo Digital Custom MIME Types
A lightweight WordPress plugin that enables uploading of custom file types (EPUB, SVG, etc.) to the WordPress media library with built-in security features.
Features
- Custom MIME Type Support: Enable additional file types in WordPress media uploads
- SVG Sanitisation: Automatic XSS protection for SVG files
- Simple Configuration: Easy-to-edit configuration array
- Moo Digital Integration: Integrates with the shared Moo Digital admin menu
- Security First: Built with WordPress security best practices
Default Enabled MIME Types
- EPUB (
.epub) -application/epub+zip - SVG (
.svg) -image/svg+xml(with XSS sanitisation)
Installation
- Download the plugin files
- Upload the
moo-digital-custom-mime-typesfolder to/wp-content/plugins/ - Activate the plugin through the 'Plugins' menu in WordPress
- Access settings via Moo Digital > Custom MIME Types in the WordPress admin
Configuration
Adding or Removing MIME Types
To modify which file types are supported:
- Open
moo-digital-custom-mime-types.php - Locate the
MOO_CUSTOM_MIMESconfiguration array (around line 24) - Add or remove entries as needed:
define('MOO_CUSTOM_MIMES', [
'epub' => 'application/epub+zip',
'svg' => 'image/svg+xml',
// Add more MIME types here:
// 'webp' => 'image/webp',
// 'woff2' => 'font/woff2',
]);
- Save the file
Common MIME Types
Here are some additional MIME types you might want to add:
'webp' => 'image/webp', // WebP images
'woff' => 'font/woff', // Web Open Font Format
'woff2' => 'font/woff2', // Web Open Font Format 2
'ttf' => 'font/ttf', // TrueType Font
'otf' => 'font/otf', // OpenType Font
'json' => 'application/json', // JSON files
'webm' => 'video/webm', // WebM video
'ogg' => 'audio/ogg', // OGG audio
Security
SVG Sanitisation
When SVG uploads are enabled, the plugin automatically sanitises uploaded files by removing:
- `