Skip Navigation

Resolved

Reported for: WPML Media Translation 2.7.0

Resolved in: 4.5.9

Overview of the issue

If you are using the SVG Support plugin, you will notice that when the WPML Media Translation plugin is active, the SVG image URL is incomplete. For example:

  • With WPML Media Translation activated: https://domain.com/wp-content/uploads/logo.svg
  • Without WPML Media Translation activated: https://domain.com/wp-content/uploads/2022/05/logo.svg

Workaround

  1. Make a full backup of your site.
  2. Open the wp-content/plugins/svg-support/functions/attachment.php file
  3. Change:
    $metadata = array(
                'width'     => intval($dimensions->width),
                'height'    => intval($dimensions->height),
                'file'      => $filename
            );
    
  4. To:
    $metadata = array(
                'width'     => intval($dimensions->width),
                'height'    => intval($dimensions->height),
                'file'      => date("Y") . '/' . date("m") . '/' . $filename
            ); 
  5. And change:
     add_filter( 'wp_generate_attachment_metadata', 'bodhi_svgs_generate_svg_attachment_metadata', 10, 3 ); 
  6. To:
     add_filter( 'wp_generate_attachment_metadata', 'bodhi_svgs_generate_svg_attachment_metadata', 1, 3 );