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 am using qtranslate plugin for my WordPress site to make it a multi-language site.

Now I have got a requirement like

For English the url should look like www.sitename.com/contact-en For French the url should look like www.sitename.com/fr/contact-fr

How can I accomplish this? (qTranslate is the plugin used)

Note: There should not be any post id coming in-between

As per the post in Multilingual permalinks (qtranslate) I tried http://www.3dolab.net/en/qtranslateslug-plugin-widget but 'page not found' errors are occurring. It looks like the author has stopped improving that plugin as per the 29th comment in that page.

share|improve this question
I'm facing exactly the same issue so I am very interested in this solution. Unfortunately, I am far from being an expert in php and therefore I did not manage to make it work for me. Could you please provide a bit more details of your piece of code. Tx in advance. – user10542 Nov 24 '11 at 0:20

In qTranslate settings in admin panel open advanced options and check the radio button for using language prefixes after domain name. I assume you have French listed in Languages settings of the plugin correct. You may expect dates shown incorrectly after that, use php date function to fix that in your particular language settings (edit language). Like j F. See primer at minexrussia.com/2011 where ru prefix is placed the same way. To avoid en prefix, select english as default language and check setting in Advanced options for not to show prefix for default language. I suggest removing all other languages except en and fr in plugin settings.

share|improve this answer
Yes I do have French in my language list. Date should not come in the url. My basic requirement is that I want the slug to be able to be given for different languages. For example: /contact-en for English, /contact-fr for French as described in my question. – Beniston Nov 16 '11 at 3:49

Please have a look at http://wordpress.org/plugins/qtranslate-slug/

Qtranslate is a nice plugin but unfortunately today is outdated. Qtranslate Slug is an addon to QTranslate, which adds support for permalinks translations and fix some QTranslate deficiencies since wordpress 3.0.

share|improve this answer
up vote 0 down vote accepted

Having the "qtranslateslug-plugin-widget" plugin working in the admin side to store slugs in the slug table, I have put my own code in the user side.

In the wp-blog-header.php page I have added my own code just before the inclusion of wp-load.php file. I took the url from $_SERVER['REQUEST_URI'], and using the slug and language in it, retrieved the post name and assigned the modified URI to $_SERVER['REQUEST_URI'] appropriately.

For example:

Before I edit: $_SERVER['REQUEST_URI'] = '/fr/french-slug';

After I edit: $_SERVER['REQUEST_URI'] = '/post-name';

Let me explain it in a little more detailed way

  1. Assign $_SERVER['REQUEST_URI'] to a variable

  2. Get the slug exploding it with slash (/)

  3. Check the slug in the slug database table which "qtranslateslug-plugin-widget" plugin is using and get the post id from there

  4. Now using the post id get the post name from the post table.

  5. Implode it in such a way as I have shown in the above example.

  6. Assign it back to $_SERVER['REQUEST_URI']

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.