// Source: https://github.com/WPTRT/code-examples/blob/master/customizer/sanitization-callbacks.php // Reference: https://make.wordpress.org/themes/2015/02/10/custom-css-boxes-in-themes/ // Reference: http://mikejolley.com/2013/08/keeping-your-shit-secure-whilst-developing-for-wordpress/ function theme_slug_sanitize_css( $input ) { return wp_filter_nohtml_kses( $input ); } /** * Sanitization: css * Control: text, textarea * * Sanitization callback for 'css' type textarea inputs. This * callback sanitizes $input for valid CSS. * * NOTE: wp_strip_all_tags() can be passed directly as * $wp_customize->add_setting() 'sanitize_callback'. It * is wrapped in a callback here merely for example * purposes. * * @uses wp_strip_all_tags() https://developer.wordpress.org/reference/functions/wp_strip_all_tags/ */ function theme_slug_sanitize_css( $input ) { return wp_strip_all_tags( $input ); }