With the release of Divi's Lootie module, uploading SVG and JSON file formats is required. However, out of the box, WordPress will block uploading of SVG and JSON files, for security reasons:
SVG files can contain malicious scripts if not sanitized.
JSON files can expose sensitive data if misused.
To use these file types, you need to allow them explicitly.
Option 1: Use a Trusted Plugin (Recommended)
The safest method is to install a plugin that sanitizes and enables uploads.
SVG Support or Safe SVG handles SVG sanitization automatically.
For JSON, plugins like File Upload Types by WPForms let you add
.jsonto the allowed file types list.
Note: The File Upload Types by WPForms plugin also allows you to enable the upload functionality for SVG files as well as other common file types that are disabled by default in WordPress.
Go to WordPress Dashboard → Plugins → Add Plugin.
Use the search box and search for File Upload Types by WPForms.
Install and activate the plugin.
From the WordPress Dashboard's sidebar, choose Settings → File Upload Types.
You can either drag and drop the SVG or JSON file into the Add Custom File Types or use the Search box and search for SVG.
Click on the checkbox.
Click on the Save Settings button.
Repeat the same steps for the JSON file format.
Option 2: Use PHP code snippets
If you don’t want extra plugins, you can add code to your theme’s functions.php file or a site-specific plugin.
Important Note: If you choose to use the following PHP code snippets, please note that this method does not sanitize the files. Only upload files from trusted sources.
Install and activate the Code Snippets plugin.
Create a new PHP code snippet.
Add the following PHP snippet:
/*Enable SVG file upload*/
function allow_svg_uploads($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'allow_svg_uploads');
/*Enable JSON file upload*/
function allow_json_uploads($mimes) {
$mimes['json'] = 'application/json';
return $mimes;
}
add_filter('upload_mimes', 'allow_json_uploads');
Best Practices
Always sanitize SVGs before upload (e.g., with SVGOMG).
Limit permissions so only trusted users can upload these file types.
Keep backups in case a malicious file is uploaded.


