WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to add languages to my wordpress driven website and i installed xili-languages plugin. Unfortunately it uses lang param to differentiate between languages and i rather have seen something like http://domain.com/cn/article-in-chinese/ rather than http://domain.com/article-in-chinese/?lang=cn

share|improve this question
If you're not forced to use xili-language, I can suggest Polylang which is a very promising plugin. – gyo May 8 '13 at 8:03
This might help wordpress.stackexchange.com/questions/34810/… – Mark Davidson Aug 9 '13 at 10:50
Agree with @gyo, Polylang is great, you should try if you've not gone too deep with xili-language. The thing you want is built in with Polylang. – ashpriom May 15 '15 at 20:21

You would like to write: http://domain.com/cn/article-in-chinese/ so that wordpress understand : http://domain.com/article-in-chinese/?lang=cn.

I think it will be easier to use http://domain.com/article-in-chinese/lang/cn/. You need to write a new rule and a new tag in WP rewrite rules (Wordpress write those rules in your htaccess) with the functions add_rewrite_rules() and add_rewrite_tag().

share|improve this answer

Set permalink to (Post Name)



Add following code to functions.php of your theme:

add_filter ( 'alias_rule', 'xili_language_trans_slug_qv' ) ;

function xl_permalinks_init () {
    global $XL_Permalinks_rules;
    if (class_exists('XL_Permalinks_rules') ) {
        $XL_Permalinks_rules = new XL_Permalinks_rules ();
        add_permastruct ( 'language', '%lang%', true, 1 );
        add_permastruct ( 'language', '%lang%', array('with_front' => false) );

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.