• Hi,

    I’m using the following code to upload SVG-files to WordPress. However no thumbnail is displayed in the admin-area.

    function custom_mtypes( $m ){
        $m['svg'] = 'image/svg+xml';
        $m['svgz'] = 'image/svg+xml';
        return $m;
    }
    add_filter( 'upload_mimes', 'custom_mtypes' );

    Is it possible to display SVG-thumbnails in WordPress?

    THX
    Jonas

Viewing 7 replies - 1 through 7 (of 7 total)
  • The limitation is more likely to be with your host or your host configuration. Consult host on allowed mime types.

    Thread Starter jonasbuck

    (@jonasbuck)

    The files get uploaded in Worpress and I can use it within my theme. But there’s no thumbnail displayed in the backend.

    I’m using the same snippet of code to add svg support to my site, and it mostly works, except not for the featured image post thumbnail.

    I can upload svg via the media uploader, I can insert svg into a post via the add media button from within the post editor, but when I try to set the featured image from within the post editor, the svg does not show up in the media library.

    In this scenario, it sort of defeats the benefit of using SVG if I have to generate a separate image for the post thumbnail.

    same for me, I can upload into the media library and insert into posts adding this code to a custom plugin:

    function allow_svg_upload_mimes( $mimes ) {
        $mimes['svg'] = 'image/svg+xml';
        return $mimes;
    }
    add_filter( 'upload_mimes', 'allow_svg_upload_mimes' );

    However when I access the media library via set featured image, I do not see the .svg images. Trying to get to the bottom of this, it may be due to the size of the .svg files uploaded…trying a few more things.
    Any suggestions?

    Well the image size of 500×500 now allows me to see the file when selecting the media for the featured image. If I try to edit the svg media file in wordpress media editor I receive this message:

    “Image data does not exist. Please re-upload the image.”

    Is there anyway to edit svg files in the wordpress image editor?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You ought to start a new thread to discuss that

    OK strike the last question.
    To stay on the same page, I do not see the featured image after I attach it. the text changes to remove featured image but I don’t see the featured image on the backend or in a list of posts.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘SVG-thumbnails in backend’ is closed to new replies.