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.

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

Problem: The user wants to only allow a WooCommerce plugin "Japanized for WooCommerce" to load if the current language is Japanese.

Solution: The "wpml_current_language" hook can be used to get the current language code from WPML. This can then be used to disable a plugin programatically.

Relevant Documentation: https://wpml.org/wpml-hook/wpml_current_language/

This topic contains 2 replies, has 2 voices.

Last updated by thomasK-90 1 month ago.

Assigned support staff: Izzi Hassan.

Author Posts
September 18, 2019 at 4:10 pm #4598737

thomasK-90

This is a follow up of this topic.
https://wpml.org/forums/topic/language-specific-plugin-usage/

I got from Laura the help on fixing the issue. However, do I have to edit the plugin file every time when it's updated?
Is there a way to make it work using functions.php?

September 19, 2019 at 12:40 pm #4604715

Izzi Hassan
Supporter

Languages: English (English )

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

Hi Thomas,

We cannot provide a solution that will work for this plugin since it is not compatible with WPML at the moment. The best solution would be to email the plugin author and ask them to modify their plugin so that it works with wpml, by adding the solution Laura provided to their plugin (with a slight modification to check if wpml is active):

$currentLanguage = apply_filters( 'wpml_current_language', NULL );
if ($currentLanguage == false || $currentLanguage == 'ja') {
    JP4WC::instance()->init();
}

You can also use the above code in functions.php to check for the current language and deactivate JP4WC that way, but we will not be able to provide support for custom solutions like this.

September 19, 2019 at 5:01 pm #4607511

thomasK-90

My issue is resolved now. Thank you!