Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing issues with language per domain configuration and WooCommerce Subscriptions displaying a staging notice.
Solution:
If you're experiencing issues with language per domain and WooCommerce Subscriptions showing a staging notice, we recommend adding the following code to the

functions.php

file in your theme folder:

// 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://your-live-site.com',
        'http://your-other-live-site.com',
        // Add more URLs as needed
    );

    // Get the current WordPress home URL
    $current_home_url = home_url();
    $current_home_url = parse_url($url, PHP_URL_PATH);
    $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;
            break; 
        }
    }
    
    return $url;
}

add_filter( 'wc_subscriptions_site_url', 'wpml_compsupp7065_filter_wc_subscriptions_site_url', 10, 4 );

Please ensure to replace the

$allowed_url_list

array with your site's URLs.

If this solution doesn't seem relevant to your issue, please open a new support ticket with us.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 6 replies, has 2 voices.

Last updated by Osama Mersal 1 year, 9 months ago.

Assisted by: Osama Mersal.

Author Posts
November 13, 2023 at 9:05 am

creativeT

language per domain and woocommerce subscriptions getting staging notice

November 13, 2023 at 9:26 am
November 13, 2023 at 9:30 am #14786745

creativeT

I hop this will not take too long, because it is a production site and they are selling already

November 15, 2023 at 11:28 am #14807565

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

1) First of all, sorry for the late reply due to a higher workload. I need your permission to take a local copy of your site to debug the issue without affecting your live site.

2) Could you please share your Debug information with me?
You can read a detailed explanation about it here. (http://wpml.org/faq/provide-debug-information-faster-support)
The debug info will give me a lot of information about how your site is configured.

Best regards,
Osama

November 15, 2023 at 11:45 am #14807715

creativeT

hereby the information

November 15, 2023 at 11:47 am #14807723

creativeT

you know you can access the site yourself?

November 15, 2023 at 11:57 am #14807773

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

1) I've taken a local copy of your site and consulted our 2nd tier support team. I'll update you as soon as I get their reply.

2) It's unrelated to the issue, but according to your Debug.info, the WP memory limit needs to be increased. PHP memory is fine, but WordPress uses 40Mb as default. The minimum requirements for WPML are 128 MB. (Kindly check this page https://wpml.org/home/minimum-requirements/)

You can increase it by adding the following code in your wp-config.php file right before the /* That's all, stop editing! Happy publishing. */ line:

/* Memory Limit */
define('WP_MEMORY_LIMIT', '256M');
define( 'WP_MAX_MEMORY_LIMIT', '256M');

Best regards,
Osama

November 25, 2023 at 8:20 pm #14923237

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for your patience. Please add the following code to the functions.php file inside your theme folder.

// 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(
        '<em><u>hidden link</u></em>',
        '<em><u>hidden link</u></em>',
        // Add more URLs as needed
    );

    // Get the current WordPress home URL
    $current_home_url = home_url();
	  $current_home_url = parse_url($url, PHP_URL_PATH);
	  $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;
            break; 
        }
    }
	
    return $url;
}

add_filter( 'wc_subscriptions_site_url', 'wpml_compsupp7065_filter_wc_subscriptions_site_url', 10, 4 );

Kindly don't forget to replace the $allowed_url_listarray with your site's URLs.

Best regards,
Osama

November 28, 2023 at 5:48 am #14935893

creativeT

THANK YOU