Opened 6 years ago
Closed 6 years ago
#46419 closed defect (bug) (duplicate)
wp_kses_post strips out srcset and sizes from img tag
Reported by: | eddhurst | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.1 |
Component: | Formatting | Keywords: | |
Focuses: | Cc: |
Description
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?
Change History (1)
Note: See
TracTickets for help on using
tickets.
Hi @eddhurst, thanks for this ticket, and welcome to Trac!
This is already being discussed over in #29807. Going to close this as a duplicate.