Make sure wp_get_attachment_image_src filter gets removed in the site-logo even when no logo exists#32187
Closed
Make sure wp_get_attachment_image_src filter gets removed in the site-logo even when no logo exists#32187
wp_get_attachment_image_src filter gets removed in the site-logo even when no logo exists#32187Conversation
|
Size Change: 0 B Total Size: 1.86 MB ℹ️ View Unchanged
|
wp_get_attachment_image_src filter gets removed in the site-logo even when no logo exists
jffng
reviewed
May 25, 2021
| add_filter( 'wp_get_attachment_image_src', $adjust_width_height_filter ); | ||
|
|
||
| $custom_logo = get_custom_logo(); | ||
| remove_filter( 'wp_get_attachment_image_src', $adjust_width_height_filter ); |
Contributor
There was a problem hiding this comment.
Does removing the filter here cause the width/height adjustments to not be applied? Since the filter is being removed before the logo is rendered, regardless of whether the logo is empty and returns early.
d792a57 to
42faee4
Compare
7 tasks
Member
Author
|
Closing this one as it is included in #32229 |
Member
Author
That one is caused by another bug, see #32092 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
In the site-logo block we're adding a filter to
wp_get_attachment_image_src. That filter is then removed at the end of the callback function, but if there is no logo then the function returns early and never reaches theremove_filtercall.Came up in WordPress/wordpress-develop#1275 (comment), already committed to the core patch so this is a backport.
Checklist:
*.native.jsfiles for terms that need renaming or removal).