- 状态
- 已解决
- 相关插件/主题
- WooCommerce Subscriptions
- 主题标签
- Compatibility
问题概述
如果您将 WooCommerce Subscriptions 与 WPML 每种语言不同域名设置搭配使用,您可能会遇到一条通知,错误地警告可能存在暂存站点或复制站点。当在同一个设置中的一个域名上启用了自动付款,然后在另一个域名上进行检查时,就可能会出现此问题。
看起来此站点已移动或是一个复制站点。WooCommerce Subscriptions 已禁用此站点上的自动付款和订阅相关电子邮件,以防止从暂存或测试环境产生重复付款。WooCommerce Subscriptions 将 https://www.domain.com 视为站点的 URL。了解更多 »。
临时解决方法
在继续操作之前,请确保对您的站点进行完整备份。
- 打开您主题的 functions.php 文件。
- 添加以下代码段:
// WPML Workaround for compsupp-7065 function wpml_compsupp7065_filter_wc_subscriptions_site_url( $url, $path, $scheme, $blog_id ) { // Define your list of allowed URLs - DO NOT add staging versions here $allowed_url_list = array( 'https://www.domain.com', 'https://www.domain.nl', // Add more URLs as needed ); // Get the current WordPress home URL $current_home_url = home_url(); $current_home_url = parse_url($url); $current_home_url = $current_home_url['host']; // Check if the current home URL is in the list foreach ( $allowed_url_list as $listed_url ) { if ( str_contains( $listed_url, $current_home_url) ) { // Replace the $url variable with the listed URL $url = $listed_url; add_filter('woocommerce_subscriptions_is_duplicate_site', '__return_false'); break; } } return $url; } add_filter( 'wc_subscriptions_site_url', 'wpml_compsupp7065_filter_wc_subscriptions_site_url', 10, 4 ); - 编辑该代码段,添加您站点的 URL 域名以替换示例。