-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for attachment image html markup #517
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 <mukeshpanchal27@users.noreply.github.com>
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
.jpg
image version instead of.webp
This PR add the support with filter
wp_get_attachment_image
same as added support forpost_thumbnail_html
.After adding the support the HTML markup generated as:
Relevant technical choices
Checklist
[Focus]
orInfrastructure
label.[Type]
label.no milestone
label.