[wp-trac] [WordPress Trac] #63714: Missing width/height attributes on SVG file since WP 6.8.2

WordPress Trac noreply at wordpress.org
Mon Jul 21 13:13:23 UTC 2025


#63714: Missing width/height attributes on SVG file since WP 6.8.2
--------------------------+---------------------
 Reporter:  rainbowgeek   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  6.8.3
Component:  Media         |     Version:  6.8.2
 Severity:  major         |  Resolution:
 Keywords:                |     Focuses:
--------------------------+---------------------

Comment (by rainbowgeek):

 Use this code to allow SVG in a mu-plugin (not Safe SVG plugin):

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

 Then upload a SVG file to the media library, pass the attachment ID to the
 $image variable:

 {{{
 wp_get_attachment_image(1, 'full', '', array('class' => 'mb-4', 'height'
 => 60, 'width' => 60));
 }}}

 Echo it in your theme somewhere.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63714#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list