-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix search block html handling for label and button text #38649
Conversation
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.
Minor suggestion re globally allowed attributes.
Any reason you're not using wp_kses_post()
and the default set of tags? It saves maintaining a separate allow list if the spec gets more tags.
), | ||
'strong' => array(), | ||
); | ||
|
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.
$wp_kses_formatting_tags = array_map( '_wp_add_global_attributes', $wp_kses_formatting_tags ); | |
Will allow advanced users to add classes, IDs and other pretty safe attributes. See
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.
I've switched it over to wp_kses_post
now, and it looks like it implicitly has the global attributes:
https://github.com/WordPress/wordpress-develop/blob/f745cc551bb0a54d7df72ec97d23e3359c56048d/src/wp-includes/kses.php#L736
Thanks for the advice!
I unashamedly copied the Navigation Link block's code. 😄 It looks like that wasn't the best code to copy. I found this discussion about it - #19477 (comment). I'll make a separate PR to update any other blocks that might be using |
* Fix search block html handling * Switch to wp_kses_post
Description
Fixes #38644
The search block was outputting escaped html in its label and button text, when it should have been outputting the tags.
In this PR I've swapped out
esc_html
forwp_kses
.Testing Instructions
Expected - the formatting should be displayed correctly
Screenshots
Before
After
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.js
files for terms that need renaming or removal).