[wp-trac] [WordPress Trac] #58402: Featured Image Preview breaks when an SVG image is uploaded.

WordPress Trac noreply at wordpress.org
Tue May 30 17:15:00 UTC 2023


#58402: Featured Image Preview breaks when an SVG image is uploaded.
------------------------------------------+------------------------------
 Reporter:  deepakvijayan                 |       Owner:  (none)
     Type:  defect (bug)                  |      Status:  new
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  Post Thumbnails               |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  2nd-opinion has-testing-info  |     Focuses:
------------------------------------------+------------------------------
Changes (by Ankit K Gupta):

 * keywords:   => 2nd-opinion has-testing-info


Comment:

 I have been able to reproduce this issue after adding a function to the
 functions.php file. By default, WordPress does not allow the uploading of
 SVG images, and only administrators can enable SVG uploads by adding a
 function to the functions.php file.
 Therefore, I am wondering if this is indeed an issue in the core of
 WordPress and it should be addressed and fixed within the core itself.
  [[Image(https://i.imgur.com/f3aqrEv.jpg)]]



 Steps to Reproduce -

 1. Edit the theme's function.php and add below function to add SVG image
 as Featured Image
 {{{#!php
 <?php
 function allow_svg_upload_featured_image($mimes) {
     $mimes['svg'] = 'image/svg+xml';
     return $mimes;
 }
 add_filter('upload_mimes', 'allow_svg_upload_featured_image');
 }}}

 2. Log in to your WordPress admin dashboard.
 3. Add a new post and upload SVG image as the featured image
 4. Image will look broken as shown in screenshot.

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


More information about the wp-trac mailing list