Tag Archives: php

Allowing upload SVG in WordPress

If you try to upload an SVG file in your WordPress media library, the process will return the error

Sorry, this file type is not permitted for security reasons

To add new MIME types (in this case SVG) to the “white list” of file formats that are allowed to be uploaded just edit your theme function.php and add:

function custom_upload_mimes ( $existing_mimes=array() ) {
	$existing_mimes['svg'] = 'image/svg+xml';
	$existing_mimes['svgz'] = 'image/svg+xml';
	return $existing_mimes;



To see how to configure lighttpd to handle correclty SVG and SVGZ please read “SVG e SVGZ con lighttpd” (in Italian)