Skip Navigation

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

Problem:

Sticky links plugin overriding translated link from String Translation.

Solution:

Sticky links adjusted the links automatically. If want to insert a link to a page that is in another language.

To be able to add links to pages in other languages, you need to add the following filter to theme’s functions.php file.

add_filter( 'wpml_sl_blacklist_requests', 'wpml_sl_blacklist_requests', 10, 2 );
function wpml_sl_blacklist_requests( $blacklist, $sitepress ) {
    $blacklist[] = 'contacts';
    $blacklist[] = 'a-nossa-equipe';
    $blacklist[] = 'contato';
    return $blacklist;
}

Relevant Documentation:

https://wpml.org/documentation/getting-started-guide/sticky-links/#linking-to-pages-in-a-different-language

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

Last updated by Apulia Vending s.r.l. 1 year, 7 months ago.

Assigned support staff: Dennis.

Author Posts
January 23, 2019 at 8:22 pm #3122454

Apulia Vending s.r.l.

I am trying to:
traslate a string, after I save it, I find it changed.
Link to a page where the issue can be seen:
hidden link
I expected to see:
at the top right the href should be hidden link
Instead, I got:
hidden link

I already deleted the string and translated it again, but nothing changed.

January 24, 2019 at 8:12 am #3123883

Dennis

Hi,

Welcome to WPML Support forum.

Please try the following steps and check if the issue still exists. Please make sure to make a complete backup of your site before proceeding.

-Go to WPML>>Support page
-Click on Troubleshooting link (link in the middle of the page)
-In Troubleshooting page, please click on the following options of 'Clean up' section. Wait for confirmation of processing after each one.
- Clear the cache in WPML
- Remove ghost entries from the translation tables
- Fix element_type collation
- Set language information
- Assign translation status to duplicated content
- Fix terms count
- Fix post type assignment
-Recreate ST DB cache tables

Please also clear your cache from 'WP Fastest Cache'.

-go to WPML > Theme and plugins localization > Strings in the themes.
-select your active theme. Click 'Scan selected themes for strings'
-go to WPML > String Translation
-translate the strings again.

Does it help?

If not, I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. 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. It would be great if can share me a screenshot of the string you're trying to translate in String Translation page.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to BACKUP the site before providing us access.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Kind regards,
Dennis

January 24, 2019 at 8:27 am #3123903

Apulia Vending s.r.l.

Hi Dennis,
thanks for your help. I did everything you suggested to do, but nothing changed. You find attached the screenshot. I did not find the fields to give you the accesses.

Kind regards,
Liborio Fedele

January 24, 2019 at 8:29 am #3123930

Dennis

Hi,

Thank you for your reply. I enabled the access information box. thanks.

Kind regards,
Dennis

January 24, 2019 at 9:00 am #3124081

Dennis

Hi,

Sticky links adjusted the links automatically. If want to insert a link to a page that is in another language, please follow this documentation:

https://wpml.org/documentation/getting-started-guide/sticky-links/#linking-to-pages-in-a-different-language

Please add this code snippet to your theme's functions.php file.

add_filter( 'wpml_sl_blacklist_requests', 'wpml_sl_blacklist_requests', 10, 2 );
function wpml_sl_blacklist_requests( $blacklist, $sitepress ) {
    $blacklist[] = 'contacts';
    return $blacklist;
}

Then translate the string again on WPML > String Translation and clear all caches.

Does it help? Please let me know.

Kind regards,
Dennis

January 24, 2019 at 9:14 am #3124158

Apulia Vending s.r.l.

Hi Dennis,
what do you mean by "insert a link to a page that is in another language"? The two links are placed in the pages of the same language as the links themselves.

Kind regards,
Liborio Fedele

January 24, 2019 at 9:19 am #3124169

Dennis

Hi,

Sorry for the confusion. Please disregard, the code snippet. Please try to translate the strings again and clear the cache.

Let me know how it goes.

Kind regards,
Dennis

January 24, 2019 at 9:22 am #3124186

Apulia Vending s.r.l.

Hi,
you're welcome. Unfortunately nothing changed, the links seem to be still automatically changed by the plugin.

Kind regards,
Liborio Fedele

January 24, 2019 at 9:34 am #3124254

Dennis

Hi,

For some reason, I suspect that sticky links adjusted the hard coded links. Could please try to add the code snippet I provided to your theme's functions.php file? Then translate the strings again and clear cache and see if it works.

Thank you.

Kind regards,
Dennis

January 24, 2019 at 9:51 am #3124377

Apulia Vending s.r.l.

Hi,
it did not work so well. Just one url was not adjusted.

Kind regards,
Liborio Fedele

January 25, 2019 at 2:26 am #3127508

Dennis

Hi,

I added $blacklist[] = 'our-team'; to the code. It seems to work now. Can you please check if it works at your end?

Thank you.

Kind regards,
Dennis

January 25, 2019 at 8:16 am #3128126

Apulia Vending s.r.l.

Hi,
it worked for the English strings, but didn't for the Portuguese ones, on the basis of yours, I added the following code so now everything work correctly.

	$blacklist[] = 'a-nossa-equipe';
	$blacklist[] = 'contato';

Now my question is: is this a bug, so it will hopefully be solved in any of next updates, or this kind of stuff just needs a customization?

Anyway thanks for your kind help.

Kind regards,
Liborio Fedele

January 25, 2019 at 9:10 am #3128266

Dennis

Hi,

Thank you for your reply.

I don't think it's a bug. Because the strings is treated by sticky links as links to the other language and automatically adjusted it. That's why adding it to the blacklist (using the code snippet) worked as described in the documentation.

https://wpml.org/documentation/getting-started-guide/sticky-links/#linking-to-pages-in-a-different-language

Kind regards,
Dennis

January 25, 2019 at 9:17 am #3128274

Apulia Vending s.r.l.

Hi,
it is not so clear to me why this case involves my issue for on the page you linked it is mentioned "you might want to insert a link to a page that is in another language", given that my purpose was to link to a page that is in the same language.

Anyway what matters is that the issue is solved.

Thanks for your help.

Kind regards,
Liborio Fedele