Skip to content

Ensure content filter runs after wp_filter_content_tags - #1236

Closed
adamsilverstein wants to merge 2 commits into
WordPress:trunkfrom
adamsilverstein:fix/img-srcset
Closed

Ensure content filter runs after wp_filter_content_tags#1236
adamsilverstein wants to merge 2 commits into
WordPress:trunkfrom
adamsilverstein:fix/img-srcset

Conversation

@adamsilverstein

@adamsilverstein adamsilverstein commented May 21, 2024

Copy link
Copy Markdown
Member

Summary

Ensures srcset is generated when JPEG generation is enabled

Fixes #1207

Relevant technical choices

Delay filteringthe_content so srcset is properly generated when "Generate JPEG files in addition to WebP" is enabled.

@github-actions

github-actions Bot commented May 21, 2024

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: adamsilverstein <adamsilverstein@git.wordpress.org>
Co-authored-by: joemcgill <joemcgill@git.wordpress.org>
Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: mukeshpanchal27 <mukesh27@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@adamsilverstein adamsilverstein added the [Type] Bug An existing feature is broken label May 21, 2024
@adamsilverstein adamsilverstein added this to the webp-uploads n.e.x.t milestone May 21, 2024
@adamsilverstein

Copy link
Copy Markdown
Member Author

I tested this fix with the image from the issue and also verified the fallback script still works correctly.

@joemcgill joemcgill left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will work, but I'd suggest using the wp_calculate_image_srcset filter for this instead so you don't have to rerun a preg_match on the final content. Approving for now since this addresses the issue.

@adamsilverstein

Copy link
Copy Markdown
Member Author

This will work, but I'd suggest using the wp_calculate_image_srcset filter for this instead so you don't have to rerun a preg_match on the final content. Approving for now since this addresses the issue.

Great suggestion, I will open an issue to follow up with this improvement.

@westonruter

Copy link
Copy Markdown
Member

Otherwise I was goin to suggest that webp_uploads_update_image_references() would do well to incorporate WP_HTML_Tag_Processor. But I guess the function would go away entirely.

@adamsilverstein

Copy link
Copy Markdown
Member Author

This will work, but I'd suggest using the wp_calculate_image_srcset filter for this instead so you don't have to rerun a preg_match on the final content. Approving for now since this addresses the issue.

I created a follow up Issue to consider this improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature is broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

srcset not created when "Generate JPEG files in addition to WebP" enabled

3 participants

Sponsor
SponsoredKunjungi sekarang
Promo