Opened 8 years ago
Closed 8 years ago
#40575 closed defect (bug) (fixed)
Typo in wp_kses_allowed_html()
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.7.4 |
Component: | Formatting | Keywords: | has-patch |
Focuses: | Cc: |
Description
There's a typo in the first occurrence of the wp_kses_allowed_html
filter inside wp_kses_allowed_html()
. The 2nd arg in the call to apply_filters()
should read $tags
, not $context
.
This may confuse users of the filter.
Attachments (3)
Change History (13)
#2
@
8 years ago
@ketuchetan thanks for 40575.patch but it's not quite right. Even though I said $tags
in the ticket description, it's not the variable to use. $allowedposttags
and $allowedtags
both hold "allowed HTML" at the point the filter runs.
#3
@
8 years ago
- Component changed from General to Formatting
- Keywords needs-patch added; has-patch removed
Introduced in [21790], docs added in [27739].
Given that this instance of the filter is only applied if is_array( $context )
and provides explicit
as the actual context, the usage appears to be correct, it just needs to be documented better.
The function docs should mention that $context
itself can be an array of allowed tags.
#5
@
8 years ago
@SergeyBiryukov agreed. If the argument passed to wp_kses_allowed_html()
is an array, the filter in question will run and $context
will be that passed array. It's worth making it clear in the inline docs for the filter that the array won't actually be "context" data, instead it'll be "allowed tags" data.
Of course, in the wild, what is passed to wp_kses_allowed_html()
can be anything, but I'm basing the above on what the function is intended to accept (described in the function signature and inline docs):
* @param string $context The context for which to retrieve tags. * Allowed values are post, strip, data,entities, or * the name of a field filter such as pre_user_description. * @return array List of allowed tags and their allowed attributes. */ function wp_kses_allowed_html( $context = '' ) {
Made the typo correction.