# TranslatePress can't translate URL of links

**URL:** <https://forum.pinegrow.com/t/translatepress-cant-translate-url-of-links/7998>\
**Category:** Pinegrow WordPress Plugin\
**Created:** [May 2, 2023, 12:56pm UTC](https://forum.pinegrow.com/t/translatepress-cant-translate-url-of-links/7998 "2023-05-02T12:56:23Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)\
**Post date:** [May 2, 2023, 12:56pm UTC](https://forum.pinegrow.com/t/translatepress-cant-translate-url-of-links/7998/1 "2023-05-02T12:56:23Z")

</div>

Hi,

I am using TranslatePress to translate a website we are developing. It sees everything correct except for URL’s in links.

I tried everything and can’t figure out what to do or what’s going on.

I also send a ticket to TranslatePress but thought i will also ask here since somebody might had the same issue with Pinegrow.

This is the video i send to TranslatePress to explain. It’s about 3min 😉

> **[Created on May 2, 2023 at 08:43](https://www.berrycast.com/conversations/2267dba5-3a9f-5fe3-b1dd-5fcb3839b293)**
>
> By Guido t Hooft | Duration 2min54s

Thanks  
Guido

---

<div class="post-metadata">

**Author:** ![adamslowe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/adamslowe/32/4590_2.png) [@adamslowe](https://forum.pinegrow.com/u/adamslowe)\
**Post date:** [May 2, 2023, 9:19pm UTC](https://forum.pinegrow.com/t/translatepress-cant-translate-url-of-links/7998/2 "2023-05-02T21:19:44Z")

</div>

Guido,

Edit:  
I might be mistaken here… I just made the link in my footer an ACF field and TranslatePress still is not letting me translate it. This leads me to believe that TranslatePress may have an issue. (I haven’t tested other translation plugins)

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/2/29cb3c68becaa2b271458af924fde1939cebcfa8.png)

Original:  
I suspect part of the issue might be that you are hardcoding the links into the PHP template files. If I’m not mistaken, TranslatePress can only translate links that are managed by the WordPress CMS. From the little bit I can see in your video, the template you made seems to be crafted more like a static web page that is being displayed with WordPress than a WordPress template that is using the CMS.

Here is a link that was created in the Gutenberg editor and is fully translatable:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/9/9bedd51294020c413b1c912903e9af68f0ebb05d.png)

And here is one that I hardcoded into the PHP file:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/8/89be484bddd95966e5eba0056fced0bbe2bce16b.png)

---

<div class="post-metadata">

**Author:** ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)\
**Post date:** [May 3, 2023, 11:31am UTC](https://forum.pinegrow.com/t/translatepress-cant-translate-url-of-links/7998/3 "2023-05-03T11:31:41Z")

</div>

Hi @adamslowe

Thanks for your reply. Yes i tried Gutenberg also and those links are fine. But hardcoded links in the php template files doesn’t work. The hardcoded images in the php template files work just fine. So it seems that TranslatePress has a bug. It seems to handle link tags as Gettext. In the settings of TranslatePress you can exclude Gettext strings.

If you put the text of the links in there then it works in TranslatePress. Found this workaround later. Still no answer from them. But pretty sure it is a mistake from their side. I see no reason to handle links as Gettext.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/5/51ae26c521137ac3d5f6088245ec2087407d2677.png)

---

<div class="post-metadata">

**Author:** ![adamslowe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/adamslowe/32/4590_2.png) [@adamslowe](https://forum.pinegrow.com/u/adamslowe)\
**Post date:** [May 3, 2023, 12:08pm UTC](https://forum.pinegrow.com/t/translatepress-cant-translate-url-of-links/7998/4 "2023-05-03T12:08:55Z")

</div>

@Guido Thanks for the follow-up! It sucks that TranslatePress is behaving that way, especially since it’s my go-to translation plugin. Hopefully, they get it fixed sooner than later.

---

<div class="post-metadata">

**Author:** ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)\
**Post date:** [May 3, 2023, 3:27pm UTC](https://forum.pinegrow.com/t/translatepress-cant-translate-url-of-links/7998/5 "2023-05-03T15:27:46Z")

</div>

@adamslowe

Yes i hope so too! Will send an update as soon as i hear from them. 😉

---

<div class="post-metadata">

**Author:** ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)\
**Post date:** [May 8, 2023, 5:36pm UTC](https://forum.pinegrow.com/t/translatepress-cant-translate-url-of-links/7998/6 "2023-05-08T17:36:04Z")

</div>

Hi @adamslowe

So i am not getting far with TranslatePress… Not super impressed with their support…

This is on of the most recent replies from them:  
"That’s correct, it’s not detectable to be translated in the way you specified.

In your case, the content is an article uploaded as an attachment and it’s not detectable. If it was written on a page that could be translated, then its URL would have been translated automatically.

To make this work, you need to change the URL directly from your code, based on the currently displayed language. On this page you’ll find the conditional language shortcode: [Conditional Shortcode Based on Language - TranslatePress](https://translatepress.com/docs/restrict-by-language/translation-shortcode/) but on the same page there is also a snippet that shows you how to get the current language in PHP. Try to use that and provide the correct link based on the current language."

I think i was pretty clear in my video on how it is set-up. I even explained in detail what i created and what the problem is. But this is the answer i got…

I explained it again and told them you’re example of the footer link also. And that everything else is translatable just fine. It only seems to be links where we need to change the URL. Like links to PDF’s and other docs or links to external websites.

I don’t see any other way on how i can set it up differently? And me or you with the footer link are not doing anything unique right? Seems to be just standard WordPress PHP files.

Anyway just thought i would lt you know and maybe you have another idea on how to tackle this.

Thanks  
Guido

---

<div class="post-metadata">

**Author:** ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)\
**Post date:** [May 9, 2023, 10:57am UTC](https://forum.pinegrow.com/t/translatepress-cant-translate-url-of-links/7998/7 "2023-05-09T10:57:02Z")

</div>

Hi @adamslowe

Latest reply from TranslatePress:  
"Hello,

This is how it works at the moment, this link falls in the internal link category that we should automatically translate, but since it’s an attachment we are not able to do that.

You should be able to solve your issue using the indicated code snippet."

So adding the text to exclude gettext in the settings will work or using the shortcode/code snippet.

Guido

---

<div class="post-metadata">

**Author:** ![adamslowe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/adamslowe/32/4590_2.png) [@adamslowe](https://forum.pinegrow.com/u/adamslowe)\
**Post date:** [May 9, 2023, 1:11pm UTC](https://forum.pinegrow.com/t/translatepress-cant-translate-url-of-links/7998/8 "2023-05-09T13:11:53Z")

</div>

Not an ideal solution, but at least it’s something. At the end of the day, though, hard coding links into the theme files probably [isn’t a great practice](https://code.tutsplus.com/tutorials/why-you-shouldnt-code-urls-in-wordpress-themes-or-plugins--cms-23262). Maybe consider using ACF fields on the relevant pages to store the URLs and retrieve them from the theme template?

---

<div class="post-metadata">

**Author:** ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)\
**Post date:** [May 10, 2023, 11:56am UTC](https://forum.pinegrow.com/t/translatepress-cant-translate-url-of-links/7998/9 "2023-05-10T11:56:46Z")

</div>

Yes that’s true. And yes will try not to hardcode links in theme files. Will use ACF or Metabox. Thanks for the link 👍
