Okay
  Public Ticket #3404576
Cannot Upload SVG
Closed

Comments

  • Adam started the conversation

    I am trying to upload a custom SVG for a store in a music playlist, but it says I am not allowed to upload that file type. It only recognizes JPEG files, but then when I upload a JPEG, I get the error message that the file type must be SVG.

    Attached files:  Screen Shot 2023-06-30 at 5.40.46 PM.png
      Screen Shot 2023-06-30 at 5.40.34 PM.png
      Screen Shot 2023-06-30 at 5.42.45 PM.png

  •  1,103
    Max replied

    Hi,

    WordPress does not typically allow SVG file uploads by default due to security reasons, but you can add support for SVGs.

    Here's how you can do that:

    Install and activate the 'Safe SVG' plugin: This plugin will allow you to upload SVG files, and it also sanitizes them to help prevent any security issues.

    After activating the plugin, you should be able to upload SVG files. Go to Media > Add New, and try uploading your SVG file there.

    If you want to do this without a plugin, you'll need to use the upload_mimes filter in your theme’s functions.php file to allow SVG file types. Here's an example of how you can do that:

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



    Thanks,


    Max from the Sonaar.io Crew