Translate custom post type and taxonomy slug in URL?
I need help how to translate the custom post type and taxonomy when using multisite and multi-language. I am using subdirectory a /en /sv etc.
Are using the plugin (Multisite Language Switcher), but can not change the rewrite settings there. So I am guesing I have to change some rewrite? Or should I translate the post type with translations file, .mo .po?
This is how the post type set up are in functions.php. Should I do something with the rewrite?
function create_posttype_product() {
register_post_type( 'product',
array(
'labels' = array(
'name' = __('Products'),
'singular_name' = __('product'),
'add_new' = __('Add new product'),
'add_new_item' = __('New product'),
'edit_item' = __('Edit product')
),
'public' = true,
'rewrite' = array( 'slug' = 'product', 'with_front' = false ),
'has_archive' = 'product',
'menu_icon' = 'dashicons-editor-help',
'supports' = array('title', 'editor', 'thumbnail')
)
);
}
add_action( 'init', 'create_posttype_product' );
So for example on english webpage url would be:
www.mypage.com/en/products
But for the swedish I want
www.mypage.com/sv/produkter
And other language :
www.mypage.com/xx/product-name-in-this-language
How can I manage to get this result? I have searched and search and can not find the right answer.
Topic url-rewriting multi-language urls Wordpress
Category Web