Skip to content
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

Ensure content filter runs after wp_filter_content_tags #1236

Closed

Conversation

 adamsilverstein
Copy link
Member

 @adamsilverstein adamsilverstein commented May 21, 2024

Summary

Ensures srcset is generated when JPEG generation is enabled

Fixes #1207

Relevant technical choices

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

Copy link

github-actions bot commented May 21, 2024

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
Copy link
Member Author

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

Copy link
Member

 @joemcgill joemcgill left a comment

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
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
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
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