Can posts or terms share the same URL slug across translations?

With Polylang Pro comes the possibility to share slugs between posts and pages.

By default WordPress will not allow two pages or posts to share the same slug. That is to say if two posts are created with the same slug, WP will automatically add a “-2” to the slug of the second post created, “-3” to the third etc.

URLs contribute to the first impression visitors will have of your site. Long URLs that contain random numbers and/or letters appear less trustworthy than URLs that convey accurate information related to the content of the page. This is where sharing slugs can come in handy.

This feature allows you to share the same slug between translations for all types of content, pages, posts, categories, tags, media, custom taxonomies… You need to use pretty permalinks and the language must not be set from the content for it to be activated.

For posts, pages, custom post types

Taken an author is presented in a post (Agatha Christie), it is useful to share the same slug between languages as the post name showing in the URL should be the same regardless of the language. If you have two languages (English and French), with Polylang Pro you will get this result:

For categories, tags, custom taxonomies

If a site references books, movies and authors. While the title of the books and the movies may vary between languages, authors’ names are unlikely to change. Taken each author corresponds to a category, it becomes possible with Polylang Pro to keep the same slug for each translation of the category

So with Polylang Pro you will get this result:

  • /en/category/agatha-christie
  • /fr/category/agatha-christie

Instead of having with Polylang:

  • /en/category/agatha-christie
  • /fr/category/agatha-christie-fr

Note that it is also possible to translate the category base in the Languages => Translations tab. See translating URLs slugs.

 

Note: It’s a known issue that when using the WordPress Importer plugin, the content having a shared slug is not imported.

Note: If you deactivate Polylang Pro, only one item among all sharing the same slug will be displayed.