Cleaned up KSES filtering overrides to utilize the designated wp_kses_allowed_html filter instead of overriding the global $allowedposttags variable manually.
Updated existing tag overrides to utilize a global set of allowed attributes ($global_attrs) to reduce repetitive definitions. In this set, we also allow wildcard data attributes (available since WP 5.-something), eliminating the need to define allowed data attributes individually
Added <picture> and <source> as allowed tags. This should avoid issues with most users having these tags stripped upon saving their posts, but until WP core rolls out full support for <picture> and srcset, there may still be issues with advanced srcset usage that we can't really fix.
Motivation and Context
Allows usage of <picture> and <srcset> in post content by users without the unfiltered_html capability. Necessary for marking up things like media backgrounds with desktop and mobile images.
How Has This Been Tested?
Reviewed in Dev.
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[x] My code follows the code style of this project.
[x] My change requires an update to the documentation.
Description
wp_kses_allowed_html
filter instead of overriding the global$allowedposttags
variable manually.$global_attrs
) to reduce repetitive definitions. In this set, we also allow wildcard data attributes (available since WP 5.-something), eliminating the need to define allowed data attributes individually<picture>
and<source>
as allowed tags. This should avoid issues with most users having these tags stripped upon saving their posts, but until WP core rolls out full support for<picture>
andsrcset
, there may still be issues with advancedsrcset
usage that we can't really fix.Motivation and Context
Allows usage of
<picture>
and<srcset>
in post content by users without theunfiltered_html
capability. Necessary for marking up things like media backgrounds with desktop and mobile images.How Has This Been Tested?
Reviewed in Dev.
Types of changes
Checklist: