-
Notifications
You must be signed in to change notification settings - Fork 106
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
Switch to wp_content_img_tag filter for Improved Image Handling #1772
Switch to wp_content_img_tag filter for Improved Image Handling #1772
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
@b1ink0 Thanks for the PR! Looks almost good to go to me, only a few points on the new function.
plugins/webp-uploads/hooks.php
Outdated
* @since 1.0.0 | ||
* @since n.e.x.t Added the `$context` and `$attachment_id` parameters. |
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.
This really is a new function as it is incompatible with the old function signature. So we should mark it as such, it's more than a change to the existing function.
plugins/webp-uploads/hooks.php
Outdated
$content = ''; | ||
} | ||
|
||
function webp_uploads_update_image_references( string $filtered_image, string $context, int $attachment_id ): string { |
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.
Since the signature is already not compatible with the old function, we can also come up with a better name given the different usage. For example webp_uploads_filter_image_tag()
.
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.
Looks good, thanks! +1 to renaming suggested by Felix.
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.
Nice work!
Summary
Fixes #1259
Relevant technical choices
This PR updates the image processing approach by transitioning from the use of the
the_content
filter to thewp_content_img_tag
filter.