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 topic contains 9 replies, has 2 voices.

Last updated by Bruno 1 year ago.

Assigned support staff: Bruno.

Author Posts
October 1, 2018 at 12:41 pm #2778131

deanP

I am trying to: I have used WPML in multisite and I have added Menu language switcher in WPML language section and display it with primary menu.

When i use "hidden link" then all URL are working fine.
When i use "hidden link" then all URL are go to hidden link, hidden link and other..

here "test" is the webalias of site also we have used many webalias here Like
"hidden link" "hidden link"

Link to a page where the issue can be seen: screenshot_1.jpg

I expected to see: Here Menu Language switcher working same on all "webalias" like as "www"

Instead, I got: I got wrong URL when i use "webalias" instead of "www"

please check and let me ASAP

October 3, 2018 at 4:05 am #2783485

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Thank you for contacting us. Please, my sincere apologies for the delay in answering.

Please as a test, could you disable all non-WPML plugins, switch to the default theme and see if the problem persists?

Also, in wp-config.php, please add these two lines before the /* That's all, stop editing! Happy blogging. */:

define('WP_HOME', '<em><u>hidden link</u></em>');
define('WP_SITEURL', '<em><u>hidden link</u></em>');

For example:

define('WP_HOME', '<em><u>hidden link</u></em>');
define('WP_SITEURL', '<em><u>hidden link</u></em>');

/* That's all, stop editing! Happy blogging. */

Following these steps, does the problem persist?

Thank you.

October 3, 2018 at 4:50 am #2783504

deanP

Hello Support,

I have followed all provided steps, deactivate all non wpml plugin and switch default theme or added site_url and Home_url but still it's not working.

define('WP_HOME', 'hidden link');
define('WP_SITEURL', 'hidden link');

I have still issue on my end.

When i use "hidden link" then all URL are working fine.
When i use "hidden link" then all URL are go to hidden link, hidden link and other..

here "test" is the webalias of site also we have used many webalias here Like
"hidden link" "hidden link"

please check and let me know.

Thanks

October 3, 2018 at 8:01 pm #2785673

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

Thank you. In this case, I'll need to request temporary access (wp-admin and FTP) to your site - preferably to a test site where the problem has been replicated if possible - in order to be of better help.

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Note:

*** Please let me know exactly what steps should I follow to see the problem.

*** Please, can I install the Duplicator or All in One Migration plugin to make a copy of your site and install it on my test environment? This will help me debug the problem.

*** Note: Please make a full backup of your site.

Privacy and Security when Providing Debug Information for Support: https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Thank you.

October 9, 2018 at 1:37 pm #2800188

deanP

Hello Support,

We are using header language switcher in our multisite. So I just want to know how you are doing language url filter for pages. I have gone through your plugin code and found that you are using $lang['url'] and some filter to for those language permalink. So Please let me know how it work for multisite.

Also we have only single site as network. No Multisite exists in network. We use our multisite without any network subsite.

Site URl :- hidden link
Subdomain Url :- samspace.truvision.directscaledev.com

samspace subdomain site not exist in our network. It is just a multisite without create in network.

Looking for your reply.

Thanks

October 10, 2018 at 6:45 am #2803120

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

For multisite this should work the same way it works for the single site. I tested this in my testing environment with just the basic WPML plugins and this worked correctly.

If you want to see how this method works or see the filter to filter the URLs, you can see in the file sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-model-build.php on line 80.

Please, let me know if I can help with any other questions you may have. I'll be happy to help.

Thank you.

October 10, 2018 at 8:42 am #2803472

deanP

Hello Bruno

Thanks for your reply.

Actually our multisite doesn't exists in network. I have gone through your code and found get_abs_home() function which return language url parameter value in this file sitepress-multilingual-cms/classes/url-handling/converter/helper/class-wpml-url-converter-url-helper.php

Here you are using blogID for blog or multisite home url for language url.

public function get_abs_home() {
if ( ! $this->absolute_home ) {
$is_multisite = is_multisite();
if ( ! $is_multisite && defined( 'WP_HOME' ) ) {
$this->absolute_home = WP_HOME;
} elseif ( $is_multisite && ! is_main_site() ) {
$protocol = preg_match( '/^(https)/', get_option( 'home' ) ) === 1 ? 'hidden link' : 'hidden link';
$sql = "
SELECT CONCAT(b.domain, b.path)
FROM {$this->wpdb->blogs} b
WHERE blog_id = {$this->wpdb->blogid}
LIMIT 1
";

$this->absolute_home = $protocol . $this->wpdb->get_var( $sql );
} else {
$this->absolute_home = $this->get_unfiltered_home_option();
}
}

return apply_filters( 'wpml_url_converter_get_abs_home', $this->absolute_home );
}

Do we have any other method or any filter name which we can put child theme to override these url. I don't want to make any custom changes in this great plugin.

If we have any filter to override this method so I can put that override filter in my child theme that it will help us alot.

Thanks.

October 11, 2018 at 12:07 am #2806005

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

There are two filters, from what I've seen. You have the "wpml_url_converter_get_abs_home" and the "WPML_filter_link".

These two filters can change the default behavior of the selector, from what I've seen.

Note again that I tested this on a new installation and I could not replicate this problem. That way, I could not see if this should be a bug, compatibility problem, or if you're using some custom coding that might be altering this.

Also, you may be using the WP_HOME constant inside the wp-config.php file and this may be affecting how your site works.

Thank you.

October 11, 2018 at 11:37 am #2807950

deanP

Hello Bruno,

Thanks for Reply !!!

We are getting a issue with language switcher option, when we use "Link to home of language for missing translations" option then it's redirect to the "home page" if any page translation are missing.

I have gone through your code but didn't get code which redirect to home page when translation is missing for that page. So please let me know which code execute when translation missing and redirect to home page in plugin file.

Please share snap of that logic/function which redirect to home page.

please check and let me know.

Thanks

October 12, 2018 at 2:22 am #2810279

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

>>> We are getting a issue with language switcher option, when we use "Link to home of language for missing translations" option then it's redirect to the "home page" if any page translation are missing.

I would be very happy to help you but I didn't fully understand what is the issue. This is expected behavior. Redirect to the homepage if the translation does not exist.

The method, however, that handles this is the "get_ls_languages" method, within the file /sitepress-multilingual-cms/sitepress.class.php on line 2611.

This method will basically define how the language selector should be displayed (which languages and how they will be displayed).

Thank you.