[wp-trac] [WordPress Trac] #64554: New src_matched value filter request
WordPress Trac
noreply at wordpress.org
Mon Jan 26 12:17:31 UTC 2026
#64554: New src_matched value filter request
-------------------------+-----------------------------
Reporter: rahu1 | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 6.9
Severity: blocker | Keywords: needs-patch
Focuses: |
-------------------------+-----------------------------
Hi,
I am uploading media to Amazon S3 and serving media URLs directly from S3.
All media URLs are successfully replaced and served from S3 without
issues.
However, when I enable object versioning in S3, WordPress fails to
generate srcset. Specifically, the URL becomes something like:
https://.../any/uploads/2026/01/8728723/a.jpg
This happens because wp_calculate_image_srcset() receives the S3 URL as
$image_src, since the URL is already replaced via a the_content filter.
Due to this, the internal src_matched check fails, and the function simply
returns false.
As a result, no srcset is generated.
I need a filter or hook inside wp_calculate_image_srcset() to detect
whether the provided image URL is an S3 URL. If it is, I need a way to
force the src_matched check to return true.
I have already tested this by modifying wp_calculate_image_srcset()
directly, and it successfully generates image sizes using the S3 URLs.
However, modifying core is not a viable solution, so I am looking for a
proper filter-based approach.
Any guidance or suggestions would be appreciated.
Thank you.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64554>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list