[wp-trac] [WordPress Trac] #46419: wp_kses_post strips out srcset and sizes from img tag

WordPress Trac noreply at wordpress.org
Tue Mar 5 12:02:16 UTC 2019


#46419: wp_kses_post strips out srcset and sizes from img tag
--------------------------+-----------------------------
 Reporter:  eddhurst      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  5.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When validating data using wp_kses_post, the img tag automatically has
 srcset and sizes stripped from the output.

 Looks like kses.php doesn't have those attributes on the whitelist
 :https://core.trac.wordpress.org/browser/tags/5.1/src/wp-
 includes/kses.php#L227

 Potentially this is just a legacy issue that this script was written
 before srcset was as widely supported and hasn't updated to include?

 I'll put a patch in shortly to suggest including these, but is there any
 reason why they shouldn't be there?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46419>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list