Skip to content

Commit

Permalink
Fix: allow svg in storefront messages, such as notices (#2133)
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhtungdu authored Jan 16, 2024
1 parent 5185bec commit e745f93
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion inc/woocommerce/storefront-woocommerce-template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
}
Expand Down

0 comments on commit e745f93

Please sign in to comment.