I am using this filter from the WordPress Codex in my function.php to allow the upload of svg, svgz and dxf files. But with all uploaded test files I have uploaded were rejected by security reasons from WordPress. Is there some more I have to pay attention to in order to get this working?

function my_custom_mime_types( $mimes ) {

    // New allowed mime types.
    $mimes['svg'] = 'image/svg+xml';
    $mimes['svgz'] = 'image/svg+xml';
    $mimes['dxf'] = 'application/dxf';

return $mimes;

add_filter( ‘upload_mimes’, ‘my_custom_mime_types’ );

Here is the source from the WordPress Codex: Plugin API/Filter Reference/upload mimes

Read more here: Debugging WordPress Filter for upload mimes


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: