Theme localization of “slugs” (custom post types, taxonomies)

Question

in my theme I want to define a series of custom post types and custom taxonomies, each one having its own customized slug; the base language of my theme is english, therefore the slugs will be in English language

for example while defining the slug of custom post type “product” args:

'rewrite' => array( 'slug' => 'product' ),

is there any way to translate the “slug” through po/mo files?
can I put it as:

'rewrite' => array( 'slug' => __('product', 'mytextdomain') )

or it won’t work? what’s the current practice to localize slugs?

0
, , , , unfulvio 3 years 2020-04-05T12:51:00-05:00 0 Answers 99 views 0

Leave an answer

Browse
Browse