From e745f93a82d4f10df9c510cc2e72e5b45d15168d Mon Sep 17 00:00:00 2001 From: Tung Du Date: Tue, 16 Jan 2024 11:40:07 +0700 Subject: [PATCH] Fix: allow svg in storefront messages, such as notices (#2133) --- ...refront-woocommerce-template-functions.php | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/inc/woocommerce/storefront-woocommerce-template-functions.php b/inc/woocommerce/storefront-woocommerce-template-functions.php index d034eea2..f97e0eba 100644 --- a/inc/woocommerce/storefront-woocommerce-template-functions.php +++ b/inc/woocommerce/storefront-woocommerce-template-functions.php @@ -235,7 +235,34 @@ function storefront_product_columns_wrapper_close() { */ function storefront_shop_messages() { if ( ! is_checkout() ) { - echo wp_kses_post( storefront_do_shortcode( 'woocommerce_messages' ) ); + $kses_defaults = wp_kses_allowed_html( 'post' ); + + $svg_args = array( + 'svg' => array( + 'class' => true, + 'aria-hidden' => true, + 'aria-labelledby' => true, + 'role' => true, + 'xmlns' => true, + 'width' => true, + 'height' => true, + 'viewbox' => true, + ), + 'g' => array( + 'fill' => true, + ), + 'title' => array( + 'title' => true, + ), + 'path' => array( + 'd' => true, + 'fill' => true, + ), + ); + + $allowed_tags = array_merge( $kses_defaults, $svg_args ); + + echo wp_kses( storefront_do_shortcode( 'woocommerce_messages' ), $allowed_tags ); } } }