-
Notifications
You must be signed in to change notification settings - Fork 99
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
Accurate sizes: Use block context approach #1625
base: feature/1511-incorporate-layout-constraints-from-ancestors
Are you sure you want to change the base?
Accurate sizes: Use block context approach #1625
Conversation
…ors' into update/use-filter-approach
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. |
Co-authored-by: Weston Ruter <[email protected]>
Co-authored-by: Weston Ruter <[email protected]>
We are tracking the unit test issue here #1634 |
return $content; | ||
} | ||
add_filter( 'render_block_core/image', 'auto_sizes_filter_image_tag', 10, 2 ); | ||
add_filter( 'render_block_core/cover', 'auto_sizes_filter_image_tag', 10, 2 ); | ||
add_filter( 'the_content', 'auto_sizes_prime_attachment_caches', 6 ); |
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.
Curious as to why priority 6 is used?
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.
Priority 6 is used to ensure the new filter runs right after the wp-image-$attachment_id
class is added to the img
tag at priority 5, allowing modifications that rely on this class being in place.
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.
Cool. Probably good to add a comment to explain why that number was chosen.
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.
LGTM, although @joemcgill would know better what to look for in what this is seeking to achieve.
Summary
These PR updates the existing code to use the new block context approach that we discussed in #1511 (comment)