Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #366711
    antonpolosin
    Participant

    Hey Guys,
    Can add SVG logo on my web. I’m using Integrity main theme, i accomplished that by adding this function to child theme:
    function cc_mime_types($mimes) {
    $mimes[‘svg’] = ‘image/svg+xml’;
    return $mimes;
    }
    add_filter(‘upload_mimes’, ‘cc_mime_types’);
    But my menu disappeared and instead i’m getting assign menu. Can i modify this function or there are other ways of adding svg files.

    Thank you

    #366728
    Thai
    Moderator

    Hi There,

    Thanks for writing in!

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    #367033
    antonpolosin
    Participant
    This reply has been marked as private.
    #367156
    Rad
    Moderator
    This reply has been marked as private.
    #367195
    antonpolosin
    Participant

    Awesome support guys. That works. Cheers

    #367196
    Rupok
    Member

    You are welcome!

    Glad that it helped. Feel free to let us know if you face any other issue. We’ll be happy to assist you.

    Thanks for using X.

    Cheers!

    #649983
    Oliver V
    Participant

    Hello!

    Just following this thread…

    I want to use svg file in my logo.

    Already added this code to my child theme functions.php

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

    However, when trying to upload the file, wordpress says that the file it is not allowed due to security reasons…

    Can you help?

    Thanks!

    I am using Icon. My site: http://www.staging4.ideasparatriunfar.com

    #650180
    Rupok
    Member

    Hi @guirot

    Thanks for updating. It should work –

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

    You can follow this for other solutions – https://css-tricks.com/snippets/wordpress/allow-svg-through-wordpress-media-uploader/

    Also this third party plugin might help – https://wordpress.org/plugins/add-full-svg-support/

    Hope this helps.

    Cheers!

    #650365
    Oliver V
    Participant

    Hello!

    I have pasted again and now is working.

    However, one more question: I have seen that SVG files are said to be a security hole for the website due to XML. Which are your suggestions? Is it worth to use SVG??

    Thanks for your help!

    Oliver.

    #650378
    Paul R
    Moderator

    Hi Oliver,

    You can some svg sanitizer, please refer to the link below for more information.

    https://wordpress.org/support/topic/svg-security

    Hope that helps.

    #650407
    Oliver V
    Participant

    OK. Great!

    However, let´s see what do you think:

    I have added your code, uploaded the svg file as logo, and later removed your code. SVG file still there as a logo, and security risk is gone due that I am not allowing more uploads. (code has been removed).

    As soon as the svg logo displays correctly, maybe is better solution for me??

    Thanks!

    Olive.r

    #650411
    Paul R
    Moderator

    Hi Oliver,

    Yes, that should work.

    Have a great day!

    #650421
    Oliver V
    Participant

    You too. Thanks!!

    Oliver.

    #650426
    Paul R
    Moderator

    You’re welcome! 🙂

  • <script> jQuery(function($){ $("#no-reply-366711 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>