WPML
状态
未解决
报告针对
WPML Multilingual CMS 4.5.14
相关插件/主题
Jetpack
主题标签
Compatibility

问题概述

如果您未登录使用 Jetpack 的站点,每当您尝试在次要语言下将产品添加到购物车时,都会遇到 404 错误。

临时解决方法

有两种可能的临时解决方法,但在继续操作之前,请务必对您的网站进行完整备份

临时解决方法 #1:编辑 Jetpack


  1. 打开 …/wp-content/plugins/jetpack/modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-universal.php 文件。

  2. 将:
    $referer_postid = isset( $_SERVER['HTTP_REFERER'] ) ? url_to_postid( esc_url_raw( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) ) : 0;

    替换为

    $referer_postid = $_POST["add-to-cart"];

临时解决方法 #2:编辑 WPML


  1. 打开 …wp-content/plugins/wpml-string-translation/classes/slug-translation/RewriteRules/Hooks.php 文件。

  2. 将:
    		if ( ! $this->cache ) {
    			$this->cache = $this->factory->create()->rewrite_rules_filter( $value );
    		}

    替换为

    //		if ( ! $this->cache ) {
    			$this->cache = $this->factory->create()->rewrite_rules_filter( $value );
    //		}

所有已知问题 →