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

WordPress Trac noreply at wordpress.org
Mon Aug 11 17:05:07 UTC 2025


#63714: Missing width/height attributes on SVG file since WP 6.8.2
-------------------------------------------------+-------------------------
 Reporter:  rainbowgeek                          |       Owner:
                                                 |  adamsilverstein
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.8.3
Component:  Media                                |     Version:  6.8.2
 Severity:  major                                |  Resolution:
 Keywords:  has-patch has-unit-tests commit      |     Focuses:
  needs-testing needs-test-info                  |
-------------------------------------------------+-------------------------
Changes (by iamshashank):

 * keywords:  has-patch has-unit-tests commit needs-testing => has-patch
     has-unit-tests commit needs-testing needs-test-info


Comment:

 == Reproduction Report
 === Description
 This report validates whether the issue can be reproduced.

 === Environment
 - WordPress: 6.8.1-src
 - PHP: 8.2.28
 - Server: nginx/1.27.5
 - Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
 - Browser: Chrome 138.0.0.0
 - OS: macOS
 - Theme: Twenty Twenty-Five 1.2
 - MU Plugins:
   * allow-svg.php
 - Plugins:
   * Test Reports 1.2.0

 === Actual Results
 1.  Unable to reproduce the issue.

 === Reproduction Steps
 1. Used this code to allow SVG in a mu-plugin
 {{{#!php
 <?php
 function wp_mime_types($mimes) {
         $mimes['svg'] = 'image/svg+xml';
         return $mimes;
 }
 add_filter('upload_mimes', 'wp_mime_types');
 }}}

 2. Then I uploaded the SVG file to the media library

 3. In the theme’s functions.php, I added this code with the correct
 attachment I'd
 {{{#!php
 <?php
 add_action('wp_head', function() {
         echo wp_get_attachment_image(15, 'full', '', array('class' =>
 'mb-4', 'height' => 60, 'width' => 60));
  });
 }}}

 4. Then i checked for both WP 6.8.1 and WP 6.8.2, but I cannot find the
 height and width attributes in any. I got everything same in both
 versions.
 [[Image(https://i.ibb.co/Hp1QDtSB/Screenshot-2025-08-11-at-10-28-20-PM.png)]]

 === Additional Notes
 - This is what I did, if I'm doing something wrong, can you review my
 steps and tell me what I'm missing?"

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


More information about the wp-trac mailing list