WordPress.org

Make WordPress Core

Opened 9 months ago

Closed 9 months 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:
PR Number:

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)

#1 @desrosj
9 months ago

  • Component changed from General to Formatting
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

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.

Note: See TracTickets for help on using tickets.