1. PROMO Upgrade to Pro Membership @ $99 / Lifetime & access all our 16+ premium Divi extensions: Divi Block, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed. Now it works with Divi 5 as well!Try our carousel AI toolkit
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color. Now it works with Divi 5 as well!
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Remove SRCSET from SVG image

Discussion in 'Free Divi Community Forum' started by pardebits, Oct 7, 2021.

  1. pardebits

    pardebits New Member

    Hi! good morning!
    We have active the option in DIVI, but we need to remove SRCSET in SVG IMAGE because is not neceesary.

    The problem is that the SVG image don't need SRCSET and the console show warnings like this:
    Failed parsing 'srcset' attribute value since its 'w' descriptor is invalid.

    How can I do this? Thanks!
     
    1. PRO MEMBER PERKS Divi Ultimate Archive Plugin - Replace the default archive "Older Entries" with beautiful pagination:Learn More
  2. Divi.Help

    Divi.Help Administrator
    Staff Member

  3. pardebits

    pardebits New Member

    Hi! Thanks for the reply!
    I already tried this code days ago, but is not working.

    I think that DIVI not use this function: wp_calculate_image_sizes
    And use a own one.

    Any ideas?

    Thanks!
     
    1. PRO MEMBER PERKS Divi Powerful Child Theme - Power up your Divi sites with tons of new functionalities & premade elements:Learn More
  4. Divi.Help

    Divi.Help Administrator
    Staff Member

    For that case, it's best for you to contact official Divi support about it & see what they say: https://www.elegantthemes.com/members-area/help/
     
  5. nihal

    nihal New Member

    Hi,

    /*
    * Remove wordpress responsive image markup for SVG
    */
    add_filter( 'wp_calculate_image_sizes', 'remove_svgt_responsive_image_attr', 10, 3 );
    function remove_svgt_responsive_image_attr( string $sizes, array $size, $image_src = null ) {
    $explode = explode( '.', $image_src );
    $image_type = end( $explode );
    if( $image_type === "svg" ){
    $sizes = "";
    }
    return $sizes;
    }
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade promo bar / notification bar with close button for your Divi site without using any plugins:View Demo
  6. pardebits

    pardebits New Member

    Hi thanks for the answer! But not work with DIVI this code.

    I asked to official support and they said:

    Sorry for the trouble! This issue has been reported to our Development Team for investigation. But unfortunately, I don't have any quick solutions for that at the moment.

    You can disable the SRCSET images entirely by disabling this option that should resolve the SVG image issue as well.


    --------

    Thanks!