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

Last updated by Diego Pereira 4 months, 4 weeks ago.

Assigned support staff: Diego Pereira.

Author Posts
May 10, 2019 at 3:27 pm #3786259

marketingD-3

I have a site where we duplicate all the pages/posts so we preserve the user inside the translated site even if the page displayed is not translated. There are a lot of links from those duplicate pages that go back to the original language (English): sometimes it is the original link, some other times is something like /?page_id=xx or /?p=xx.

We found out that we had some links with HTTPS, some others with HTTP. So we did a search/replace, then, re-duplicate all the duplicate pages, but that didn't fix the links and it is because in STRING TRANSLATION it is already defined and not updated.
We also use the "Translate Link Targets" under settings, but we found out that links aren't fixed there because in the table "wp_icl_strings" those links are marked as LINE and not LINK. We believe that it is because they are not identified as internal link because they don't have HTTPS.

Only when we save the page, then go to String translation and click save translation that fixes the problem, but we cannot do that for all the duplicate pages/post because they are a lot. So we are seeking for an alternative solution on this.

Thank you.

May 10, 2019 at 4:37 pm #3786737

Diego Pereira
Supporter

Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português )

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

Hello @marketingd-3, welcome to the WPML support Forum!

By string translation do you mean th WPML Translation Editor (when you click the "+" icon to translate a post or a page) ou the String Translator (WPML > String Translation)? I got a little confused. Could you send us some screenshots?

We have the WPML Sticky links extension that automatically corrects links in the translations so that they always point to the translated content. Could you install it and see if that solves the problem? You can download it here: https://wpml.org/account/downloads/

Regarding the http / https issue, could you please install this plugin and check if it solves it? https://wordpress.org/plugins/really-simple-ssl/

All the best,
Diego

May 10, 2019 at 4:49 pm #3786793

marketingD-3

Hi Diego,

Thank you for taking the time and effort to help us on this issue.

We already performed a search/replace on wp_posts table, so we no longer have links with HTTP as opposed of HTTPS.

I forgot to mention that we use the Visual Composer plugin, so the content in our pages gets split and put into string translation.

I am attaching some screenshots from the database we I show how internal links are being marked with type = LINE, and I believe that it is because the original link didn't have HTTPS so the link might look as an external link and not an internal link to be fixed.

I am attaching also the Code I identified that looks only for type = LINK, leaving type = LINE out. The code in the screenshot is from the method fix_links_to_translated_content under the WPML_Pro_Translation class /wp-content/plugins/wpml-translation-management/inc/translation-proxy/wpml-pro-translation.clas.php

May 13, 2019 at 4:36 pm #3800633

Diego Pereira
Supporter

Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português )

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

Hi there,

Please send us access to your WordPress dashboard (website URL, login and password) I'll check and do some tests. - Please use the private field to send the sensitive data - do not post if you do not see it.

It would be better if you give me a test site rather than the live site.

IMPORTANT Please backup a working copy of site files and database before.

Please also install these plugins. They will allow me to create a copy of the website if needed:
Duplicator: https://wordpress.org/plugins/duplicator/
File Manager: https://wordpress.org/plugins/wp-file-manager/
All-in-one WP Migration hidden link
Cloudways WordPress Migrator https://wordpress.org/plugins/bv-cloudways-automated-migration/

Kind regards,
Diego

May 14, 2019 at 3:39 pm #3808767

Diego Pereira
Supporter

Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português )

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

Hi there,

Thank you very much! The clean install makes it much easier to see the problem.

I did some tests but did not found a solution so far. I'm checking this issue with my team and I'll send you feedback soon.

Kind regards,
Diego

May 15, 2019 at 2:19 pm #3817569

marketingD-3

Hi Diego,

How is this going?

I am leaning towards doing a search/replace on the wp_icl_string table, then do an update query like this:

UPDATE wp_icl_string SET type = 'LINK' WHERE `value` LIKE '<em><u>hidden link</u></em>'

By putting that WHERE I will be targeting all the internal links, after the search/replace is done.

Let me know if you see any problem if above solution.

May 16, 2019 at 4:58 pm #3828177

Diego Pereira
Supporter

Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português )

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

Hi there,

I checked with my team and the translate link target functions checks for the protocol with site URL. I did some tests but no found a solution so far, and now there is a odd new issue (a lot of links to scan, see screenshot). I will need to duplicate it to my local server to further debug.

Your SQL query seems ok to me. I think it may work. Could you please test it? Please run a complete backup of the website before, so you will be able to restore it if anything goes wrong.

If possible, please test with a staging version of the website before. If you want, I can clone the website on my local server to test it.

Please let me know if it worked for you.

Kind regards,
Diego

May 16, 2019 at 5:13 pm #3828251

marketingD-3

Hi Diego,

I am working on a different staging environment in which I am applying the solution I described, and in fact, it is fixing the URLs in string translation correctly. However, it is not updating the translated page. Very weird, because I've seen that when I update something in String Translation that is related to the page builder, it updated the translated page.
Do you have any idea how string translation updates a translated page? I am trying to look in the code and haven't seen how.

Regarding the screenshot you attached. I noticed that too, but I don't know why so many strings.

May 17, 2019 at 2:09 pm #3835145

Diego Pereira
Supporter

Languages: English (English ) Spanish (Español ) Portuguese (Brazil) (Português )

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

Hi there,

If you manually update a page (Edit Page > Click on update), it will fix the issue on the translation?

If so, please try the following:
- Go to Pages > All Pages (or Posts > All Posts)
- Select 10 posts and click on Bulk Actions > Edit
- Click on Update
Does it fix the issue on the selected posts?

Another possible solution I thought was to delete existing duplicates and then bulk them twice again through WPML Translation Management. Could you please test this with some posts?

Please let me know if it worked for you.

Kind regards,
Diego