[wp-trac] [WordPress Trac] #29807: add support for picture element and srcset attribute on img in wp_kses

WordPress Trac noreply at wordpress.org
Sun Aug 24 10:14:48 UTC 2025


#29807: add support for picture element and srcset attribute on img in wp_kses
--------------------------------------+------------------------------
 Reporter:  mattheu                   |       Owner:  adamsilverstein
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  6.9
Component:  Formatting                |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------------

Comment (by oglekler):

 I have "Cannot use wp_kses_post(), see Readme..." all over the place.

 So, I've tested the patch with my real project. WP 6.8.1, FCE, Images in
 S3 bucket, Images customizes to work with external resizer, image URLs
 looks like:

 {{{
 https://[RESIZER_URL]/cdn-
 cgi/image/format=auto,onerror=redirect,quality=80,width=412,height=275,dpr=1,fit=crop,gravity=0.5x0.5/https://[BUCKET_URL
 ]/wp-content/uploads/2025/08/...
 }}}


 **Result ❌**
 - lost {{{decoding="async"}}}
 - lost {{{fetchpriority="high"}}}
 - lost {{{gravity=0.5x0.5/https:}}} from srcset (but not from src)
 - got spaces after commas in srcset (but not in src)

 This led to getting original image instead of the resized (2.1Mb instead
 of 58kb) 😱 and can ruin my project performance.

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


More information about the wp-trac mailing list