- 状态
- 已由作者解决
- 相关插件/主题
- Customer Reviews for WooCommerce
- 主题标签
- Compatibility
问题概述
如果您使用简码在产品页面上显示来自 Customer Reviews for WooCommerce 插件的评论,并结合使用 WooCommerce > WPML Multilingual & Multicurrency for WooCommerce > 设置页面中的 Show reviews in all languages 选项,您可能会遇到在产品的翻译版本上无法看到评论的问题。
临时解决方法
在继续操作之前,请确保对站点进行完整备份。
- 打开 …/wp-content/plugins/customer-reviews-woocommerce/includes/blocks/class-cr-reviews-grid.php 文件。
- 找到第 148 行。
- 在此代码区块之后:
$args = array( 'status' => 'approve', 'post_type' => 'product', 'meta_key' => 'rating', 'orderby' => $order_by, 'post__in' => $post_ids, 'comment__not_in' => $comment__not_in );
- 添加以下内容:
if (is_array($args['post__in']) && count($args['post__in']) === 1) { $args['post_id'] = array_shift($args['post__in']); unset($args['post__in']); }