[wp-trac] [WordPress Trac] #40298: Translated custom post type archive slug is in user language, not site language

WordPress Trac noreply at wordpress.org
Wed Mar 29 13:20:30 UTC 2017


#40298: Translated custom post type archive slug is in user language, not site
language
--------------------------+------------------------------
 Reporter:  docflo        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  I18N          |     Version:  4.7.3
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  template
--------------------------+------------------------------

Comment (by Chouby):

 IMHO, you must not internationalize CPT slugs bases. WordPress has no slug
 base for CPT but it has for taxonomies (categories, tags and post
 formats), and you'll see that they are not internationalized. See
 https://github.com/WordPress/WordPress/blob/4.7.3/wp-
 includes/taxonomy.php#L38-L53

 The reason is exactly the kind of issue you are running in. A CPT slug
 base must never change on your site. If you are writing a plugin, the
 translations may not be available first. So the slug base will be
 'events'? Then at some point, the translations will become available and
 the slug base will become 'translated_events' changing all the
 corresponding urls.

 If you want to allow the customization of your custom post type slug base,
 the best is to do as done by WordPress for categories and tags and provide
 an option. If this is for a unique project, you can just hardcode it in
 your language.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40298#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list