[wp-trac] [WordPress Trac] #63046: Add additional CSS style properties to the safe_style_css filter

WordPress Trac noreply at wordpress.org
Mon Mar 3 20:10:16 UTC 2025


#63046: Add additional CSS style properties to the safe_style_css filter
-------------------------+-----------------------------
 Reporter:  mi5t4n       |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 Currently, when using the following code, CSS properties like background-
 clip and display are stripped out during the wp_kses_post() sanitization
 process.

 {{{#!php
 <?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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63046>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list