Closed janboddez closed 9 months ago
As of WP 5.3, larger images are scaled down (by default, at least). https://make.wordpress.org/core/2019/10/09/introducing-handling-of-big-images-in-wordpress-5-3/
The image metadata contains a original_image
but it is near impossible to query for it.
Alternatively, could use a slightly altered attachment_url_to_postid()
.
Not perfect; there might be super rare false positives or something, but ... close enough.
The alternative would be simply grabbing the IDs from the Image blocks, but that'd only work for block editor posts. Or use their class
or something, I think WP adds the attachment ID to images' class
attributes. Next time.
Because they end up in the post content like, e.g.,
IMG_8432-1024x683.jpg
while thecorresponding
database entry isIMG_8432-scaled.jpg
.