A wordpress website with bilingual setup, with three languages:
- English ("primary language") : "en"
- Traditional Chinese : "zh-hant"
- Simplified Chinese : "zh-hans"
The bilingual setup is currently achieved with the polylang plugin.
I would like to have different URL structure based on the post's language.
For English,
example.com/blog/%category%/%postname%/
And the above permalink sturcture is my current set up in the WP permalink setting page. (custom structure, /blog/%category%/%postname%/)
But for non-English blog post URL, I would like to use post id instead of postname:
example.com/zh-hant/blog/%category%/%post_id%
The polylang plugin does not allow me to have different permalink setting per language, so I think I need a custom function solution to this.
%post_title%
- I think you meant%postname%
? And what is your current permalink structure? Does it have "blog" -blog/%category%/%postname%
- could you please add the structure into your post?example.com/blog/zh-hant/
, I believe, should have beenexample.com/zh-hant/blog/
.. :) Anyway, see my answer.