Skip Navigation

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

Problem:
Country flag on product review shows up in current language instead of the language of the client

Solution:
Temporary solution by adding following code in functions.php:

add_filter ('the_comments', 'remove_hooks10903');
function remove_hooks10903($var) {
    global $wp_filter;
        foreach ( $wp_filter["the_comments"]->callbacks[10] as $key => $value ) {
            if ( str_contains( $key, 'translate_product_ids' ) ) {
                remove_filter( 'the_comments', $key );
            }
        }
    return $var;
}

Relevant Documentation:

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 13 replies, has 2 voices.

Last updated by basv-25 1 year, 5 months ago.

Assisted by: Waqas Bin Hasan.

Author Posts
July 5, 2023 at 6:59 am

basv-25

Country flag on product review shows up in current language instead of the language of the client

July 5, 2023 at 9:05 am
July 6, 2023 at 6:39 am #13955117

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

I am assigned this ticket and 'll try my best to help you on the matter.

Since it is a staging site, it should be fine to do the followings but of course I'll need your confirmations first:

- Deactivate plugins except the ones required.
- Update WCML and any necessary plugin.
- Take a copy of your site using Duplicator or All in one Migration plugin.

The later may be required to escalate the issue to our 2nd tier, so we can try, reproduce and find the issue in another environment. And then apply the fix on the staging and provide you the details for a fix on production.

See https://wpml.org/faq/provide-supporters-copy-site/ for more details.

Please let me know.

Regards.

July 6, 2023 at 7:54 am #13956073

basv-25

Hi Waqas, nice to meet you. Yes, you sure may play around on the staging environment, no problem at all.

Thanks in advance,

July 6, 2023 at 12:12 pm #13959603

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for confirming, I am working on it and 'll get back to you as soon as I've some progress.

July 6, 2023 at 12:15 pm #13959607

basv-25

Thanks

July 7, 2023 at 7:10 am #13964847

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation on this.

I've escalated the matter to our 2nd tier after running a few more tests on the staging site. Please keep the site as it is in the current state, so our team can continue and investigate accordingly.

I'll update you as soon as I've some progress.

July 7, 2023 at 12:45 pm #13968049

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Team suggests that you may try disabling/deactivating the cache as well, to check if it makes any difference.

Although I've cleared the caches during the tests but I can't find where I can disable Kinsta Cache temporarily. Please try this and let me know.

July 7, 2023 at 12:50 pm #13968111

basv-25

Hi Waqas, the staging environment doesn't use cache, this is standard off at Kinsta, see print screen, please advise. ("uitgeschakeld" means "turned off")

Scherm­afbeelding 2023-07-07 om 14.49.16.png
July 7, 2023 at 1:05 pm #13968165

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Actually I am seeing this in staging and have been using these cache buttons and in response getting message like "Cache cleared successfully".

So I believe it is active and working. However, not sure if deactivating in your control panel still leaves these controls active for some reason, while cache is truly disabled.

Can you please confirm so we are sure about it?

cache.jpg
kinsta.jpg
July 7, 2023 at 1:15 pm #13968261

basv-25

Hi Waqas, the button indeed is always active, not sure why. But I'm very sure the staging isn't cached. Otherwise you can test by putting /?nocache behind the url (kinsta doesn't cache these even not on our live environment).

Thanks so much in advance,

July 7, 2023 at 1:18 pm #13968271

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for confirming, I've updated the team about it and 'll get back to you as soon as there's more progress.

July 7, 2023 at 1:19 pm #13968275

basv-25

Perfect, thanks

July 10, 2023 at 12:31 pm #13998081

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Our team found the issue and suggested the following workaround (temporarily):

add_filter ('the_comments', 'remove_hooks10903');
function remove_hooks10903($var) {
	global $wp_filter;
		foreach ( $wp_filter["the_comments"]->callbacks[10] as $key => $value ) {
			if ( str_contains( $key, 'translate_product_ids' ) ) {
				remove_filter( 'the_comments', $key );
			}
		}
	return $var;
}

I've added and tested this code in your current theme's functions.php file (at end of the file). And now I can see correct flags at:

- French: hidden link
- Spanish: hidden link

Notice that I also added a comment (wpml) on Spanish version and then translated it to French as well.

Meanwhile the case has been escalated further to the dev team and they'll take care of it. This 'll probably be rolled out in a future version of the WCML plugin.

Please check and confirm, thanks.