WPML

问题概述

如果您使用简码在产品页面上显示来自 Customer Reviews for WooCommerce 插件的评论,并结合使用 WooCommerceWPML 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']);
    }

所有已知问题

仍然遇到此问题?

如果更新无法解决问题,请提出支持问题,我们将与您一起排查。