要从购物车和结帐中的产品名称中删除 HTML 标签,您可以使用以下命令:
add_filter('woocommerce_cart_item_name', 'strip_html_tags_from_cart_item_name', 20, 1 );
function strip_html_tags_from_cart_item_name( $product_name ) {
$product_name = wp_strip_all_tags( $product_name, true );
return $product_name;
}
代码位于活动子主题(或活动主题)的functions.php 文件中。已测试并有效。