Selecting specific image size fails and falls back to "full" when large image is scaled
If a specific image size is selected in the builder to display AND the image has been scaled down due to it being a large resolution (https://make.wordpress.org/core/2019/10/09/introducing-handling-of-big-images-in-wordpress-5-3/), the internal function mfn_get_attachment_id_url
fails.
This function uses a custom database query that is looking for a GUID that doesn't exist.
The image itself has "-scaled" appended to the filename, but the GUID in the database remains as the original. The image_url
and the guid
therefore do not match in the query.
The function is obsolete, as there is a built in function that does the same - and effectively.
Can you please either remove mfn_get_attachment_id_url
or use the WP function of attachment_url_to_postid
(which has been in place since WP V4.0) inside it?
Comments
To reproduce:
To fix:
mfn_get_attachment_id_url
with `return attachment_url_to_postid($image_url);`mfn_get_attachment_id_url
to replace with `return attachment_url_to_postid($image_url);`Hi,
Thanks for reporting.
I have passed this problem to the dev team, and we will fix it as soon as possible.
Best regards
Great, thanks