Opened 7 weeks ago
Last modified 7 weeks ago
#63046 new enhancement
Add background-clip to the safe_style_css filter
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Formatting | Keywords: | has-patch |
Focuses: | Cc: |
Description
Currently, when using the following code, CSS properties like background-clip and display are stripped out during the wp_kses_post() sanitization process.
<?php add_action('init', function() { $html = ' <span style=" background-clip: text; display: inline-block;"> Gradient Text </span> '; $sanitize_post = wp_kses_post( $html ); });
Expected Output:
<span style="background-clip: text; display: inline-block;"> Gradient Text </span>
Current Output:
<span> Gradient Text </span>
The issue occurs because CSS properties like background-clip and display are removed. It would be helpful to allow additional CSS properties through the wp_kses_post()
function by extending the safe_style_css filter to support these properties.
Change History (6)
This ticket was mentioned in PR #8445 on WordPress/wordpress-develop by @mi5t4n.
7 weeks ago
#1
- Keywords has-patch added
#2
@
7 weeks ago
The committed change on #56122 did not include display
so the function would not allow display: none
(by default).
https://github.com/WordPress/wordpress-develop/pull/2928#discussion_r912554761
#3
@
7 weeks ago
@sabernhardt Thanks for the context. It looks like the display:none
was deliberately left out. Should I proceed with updating the PR to include just the background-clip
CSS rule?
Trac ticket: https://core.trac.wordpress.org/ticket/63046
This PR adds
background-clip
anddisplay
CSS rule tosafecss_filter_attr()
function.