- 状态
- 已由作者解决
- 相关插件/主题
- Customer Reviews for WooCommerce
- 主题标签
- Compatibility
问题概述
当启用 CusRev 的 Customer Reviews for WooCommerce 插件及其 CusRev 视觉样式时,翻译后的评论无法按预期显示。即使通过 WPML 字符串翻译对评论进行了翻译,显示的评论也不是翻译后的版本。
临时解决方法
请在继续操作之前,确保对您的站点进行完整备份。
- 将以下代码添加到您主题的functions.php文件中:
//Fix for compsupp-6829 add_action ('the_comments', 'customer_reviews_remove_hooks', 1, 9); function customer_reviews_remove_hooks($comments) { global $wp_filter; foreach ($wp_filter["the_comments"]->callbacks[10] as $key => $value) { if(str_contains($key, 'translate_product_ids')){ remove_filter( 'the_comments', $key, 10 ); } } return $comments; }