[wp-trac] [WordPress Trac] #54170: wp_kses_allowed_html stripping picture tags
WordPress Trac
noreply at wordpress.org
Thu Sep 23 17:48:51 UTC 2021
#54170: wp_kses_allowed_html stripping picture tags
--------------------------+-----------------------------
Reporter: shaneonabike | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Since the latest release of {{{wp_kses_allowed_html}}} it would appear
that the function is stripping picture tags. I don't really understand why
these are considered invalid. Specifically: picture, source, media and
srcset.
My scenario is to provide better image rendering than the default setup by
WordPress so I generate a <picture> tag.
Is it possible to add these to allowed html rather than requiring folks to
create a custom filter as I have created below:
{{{
add_filter('wp_kses_allowed_html','kses_filter_allowed_html',10,2);
function kses_filter_allowed_html($allowed, $context) {
if (is_array($context)) return $allowed;
if ($context == 'post') {
$allowed['picture'] = true;
$allowed['source']['media'] = true;
$allowed['source']['srcset'] = true;
}
return $allowed;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54170>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list