Skip to main content
All CollectionsWordPress
How to upload SVG files
How to upload SVG files

How to upload SVG files to your WordPress website

Erik Lidén avatar
Written by Erik Lidén
Updated over a week ago

WordPress does not allow uploading of SVG by default because of security risks.

You can allow SVG to be uploaded on your website by using a plugin like:

Otherwise you can just add this code to your functions.php:

WARNING: Before doing the below, please make sure to make a backup, since your website can potentially crash if you do this incorrectly.

function add_file_types_to_uploads($file_types){
$new_filetypes = array();
$new_filetypes['svg'] = 'image/svg+xml';
$file_types = array_merge($file_types, $new_filetypes );
return $file_types;
add_filter('upload_mimes', 'add_file_types_to_uploads');

Did this answer your question?