admin管理员组

文章数量:1122846

I have been using the "Polylang" plugin to translate my website. The original page has the URL "mysite.de/about-us". The translated page should have the URL "mysite.de/en/about-us". The "/en/" part has already been added by the plugin and is also displayed that way in the WordPress page editor. However, WordPress automatically adds a "-2" to the slug. This makes it difficult for internal links that should point to the correct page using , depending on whether the URL with "/en/" is being accessed or not. Is there a way to prevent WordPress from adding "-2" to the slug?

Regards

I have been using the "Polylang" plugin to translate my website. The original page has the URL "mysite.de/about-us". The translated page should have the URL "mysite.de/en/about-us". The "/en/" part has already been added by the plugin and is also displayed that way in the WordPress page editor. However, WordPress automatically adds a "-2" to the slug. This makes it difficult for internal links that should point to the correct page using , depending on whether the URL with "/en/" is being accessed or not. Is there a way to prevent WordPress from adding "-2" to the slug?

Regards

Share Improve this question edited Jun 1, 2023 at 14:00 PhpDoe 2992 silver badges11 bronze badges asked May 30, 2023 at 15:31 JustinJustin 11 silver badge1 bronze badge 2
  • Depending on the plugin, it may be using some permalink trickery to add the "/en" in your URL, which might mean two pages can't have the same slug. I don't know anything about Polylang, but if you want support specific to that plugin you'll have to contact their specific support routes as questions about third-party plugins are off-topic here. – YourManDan Commented May 31, 2023 at 14:06
  • 1 As an alternative solution, can I suggest translating the slug into whatever other language you're using? It will be best practice for SEO and usability instead of the workaround you're looking for. – YourManDan Commented May 31, 2023 at 14:07
Add a comment  | 

3 Answers 3

Reset to default 1
  1. Go on your back-office, and go on Polylang (Languages) Settings.
  2. Then, on URL modifications, check if the option "The language is set from the directory name in pretty permalinks" is checked.
  3. If not, check it.
  4. Then click on Save changes. Now, you should see this option below : "Share slugs Activated"

"Allows to share the same URL slug across languages for posts and terms. The module is automatically deactivated when using plain permalinks or when the language is set from the content in the URL modifications."

Now you should be able to have the same url slug across different languages. It works on my website. With these settings, I can obtain:

example.com/about-us/ (main language)

example.com/en/about-us/ (translated content)


However, I dont recommend you to use the same slug across different languages. It's not a good practice and harm the SEO of your website.

Hope it helps !

Also you can use the plugin to bulk update slug - Polylang same slug

Sharing slugs is a feature available only in Polilang Pro

本文标签: Duplicate Slugs on multilingual site (with Polylang)