[wp-trac] [WordPress Trac] #38672: Custom CSS should work with existing Jetpack custom CSS

WordPress Trac noreply at wordpress.org
Tue Nov 8 05:31:46 UTC 2016


#38672: Custom CSS should work with existing Jetpack custom CSS
-----------------------------+------------------
 Reporter:  helen            |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  highest omg bbq  |   Milestone:  4.7
Component:  Customize        |     Version:
 Severity:  blocker          |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------

Comment (by westonruter):

 @georgestephanis here's what I have in mind for adding restrictive
 filtering for `custom_css` settings for underprivileged users (who lack
 `unfiltered_html`). The following gives the essential logic for what I
 think Jetpack could do:

 {{{#!php
 <?php
 add_action( 'customize_register', function( WP_Customize_Manager
 $wp_customize ) {
         $sanitize_css = function( $css ) {
                 if ( ! current_user_can( 'unfiltered_html' ) ) {
                         $css = jetpack_sanitize_custom_css( $css );
                 }
                 return $css;
         };

         foreach ( $wp_customize->settings() as $setting ) {
                 if ( $setting instanceof WP_Customize_Custom_CSS_Setting )
 {
                         add_filter( "customize_sanitize_{$setting->id}",
 $sanitize_css, 10, 2 );
                 }
         }
 }, 20 );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38672#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list