Skip to content

fix: Fix bug for attachments without width and height#115

Merged
gchtr merged 1 commit into2.xfrom
2.x-fix-pdf
Dec 23, 2025
Merged

fix: Fix bug for attachments without width and height#115
gchtr merged 1 commit into2.xfrom
2.x-fix-pdf

Conversation

@gchtr
Copy link
Copy Markdown
Member

@gchtr gchtr commented Dec 23, 2025

This change fixes a bug when PDF thumbnails couldn’t be accessed or generated.

In the image_downsize filter, we change the logic so that when no width and height is present in the metadata, we bail out of the request and let WordPress handle the request further instead of returning an array with the src, width and height. This makes sense for non-image attachments.

With this change, PDF thumbnails can now be accessed using the wp_get_attachment_image_src() function.

This fixes a bug when PDF thumbnails couldn’t be accessed
@gchtr gchtr merged commit 6fd5c6b into 2.x Dec 23, 2025
8 checks passed
@gchtr gchtr deleted the 2.x-fix-pdf branch December 23, 2025 12:55
This was referenced Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant