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
3 Answers
Reset to default 1- Go on your back-office, and go on Polylang (Languages) Settings.
- Then, on URL modifications, check if the option "The language is set from the directory name in pretty permalinks" is checked.
- If not, check it.
- 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)
版权声明:本文标题:Duplicate Slugs on multilingual site (with Polylang) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736302036a1931389.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论