Added support for attachment image html markup#517
Conversation
mukeshpanchal27
left a comment
There was a problem hiding this comment.
@maheshwaghmare Thanks for the PR. Can you please correct the unit tests?
@felixarntz I think it's good to update the markup for wp_get_attachment_image. Please share your thoughts on this.
Co-authored-by: Mukesh Panchal <[email protected]>
Co-authored-by: Mukesh Panchal <[email protected]>
felixarntz
left a comment
There was a problem hiding this comment.
@maheshwaghmare Thank you for the PR and for contributing to the performance plugin.
Unfortunately, at this point making this change is a bit preliminary and goes beyond what the current plan of the WebP module is, which is to automatically modify in-content images. Images retrieved via wp_get_attachment_image() are controlled by code (e.g. in a theme), and for now it was decided to leave control about that to the theme owner. For example, @jjgrainger has already been working on a core PR WordPress/wordpress-develop#3074 for this (which is closed for now, since this infrastructure will currently not proceed).
I think it's great you are raising this problem again in this PR though, and I agree we should think through it again, so I opened #523 for this purpose. Let's discuss there first whether that makes sense and what the potential complications are, before potentially proceeding with this PR.
Only marking this as requesting changes for now to first have this conversation.
Summary
After enabling the SVG image support when we use the function
wp_get_attachment_image()used as:Then the HTML is generated as:
It keep serve the
.jpgimage version instead of.webpThis PR add the support with filter
wp_get_attachment_imagesame as added support forpost_thumbnail_html.After adding the support the HTML markup generated as:
Relevant technical choices
Checklist
[Focus]orInfrastructurelabel.[Type]label.no milestonelabel.