Support » Plugin: One Click Demo Import » Enable SVG upload before Demo import

  • Resolved shofera

    (@shofera)


    Hi,

    I have some SVG images that I want to include with the import file.
    So I need to enable the SVG upload before the import starts.
    I tried using the before_content_import action and in it I add a filter to enable that, I think the filters don’t get applied at this point though as this doesn’t seem to work. How would I go about this? Thanks!

    My code:

    // Enable SVG upload for import
    function upload_svg_mime_type($mimes) {
      $mimes['svg'] = 'image/svg+xml';
      return $mimes;
    }
    function my_before_content_import( $selected_import ) {
        add_filter('upload_mimes', 'upload_svg_mime_type');
    }
    add_action( 'pt-ocdi/before_content_import', 'my_before_content_import' );
Viewing 1 replies (of 1 total)
  • Hi shofera, I’m not a plugin author, just a user, but I’d like to explain you why this is wrong, as I stumbled on SVG before.
    SVG is XML.
    XML can contain executable commands and can break the contents, injecting malwares in a very easy way.
    This is why is not a valid media format in WordPress. Is ok to use them as part of themes as static files, but allowing the upload would expose yout websites to serious vulnerabilities, and allowing upload of xml in conjunction with unknown plugins “unfiltered” upload options means 100% hacking guarantee.

    That’s why you should not do this and why WP doesn’t allow it out of the box 😉

    • This reply was modified 2 years, 4 months ago by QantumThemes.
Viewing 1 replies (of 1 total)
  • The topic ‘Enable SVG upload before Demo import’ is closed to new replies.