qTranslate-X : Using qTranslate Slug plugin to translate permalinks

WordPress qTranslate Slug Plugin - translating URL permalinks

When using a WordPress qTranslate-X plugin on a website, you might also want to translate permalinks (also known as slugs). Currently, qTranslate-X doesn't support this feature, but we can use other WordPress plugin named qTranslate Slug that does exactly that. In this article, we will explore the widget and the settings available for qTranslate Slug. Finally, we will examine, how to use it.

The qTranslate Slug plugin is an add-on for mQtranslate and qTranslate, both of which are now deprecated in favor of qTranslate-X plugin. With this add-on, we can translate permalinks (slugs) for posts & pages.

Warning: Personally, I haven't had any issues with this plugin, but in official qTranslate-X FAQ page, it says that using qTranslate Slug in some configurations is not safe and that you might end up with some problems. Therefore, consider making a backup before trying to use it.

Let's examine this addon in a little more detail.

Note: In this tutorial, the qTranslate-X plugin has two languages enabled, the English (default) and a German language.

qTranslate Slug Settings

We can find settings for qTranslate Slug by going to Dashbord > Settings > Slug options.
There, we have the options to:

  • Add translations to tags and categories taxonomies:

    Qtranslate Slug Plugin - settings options for categories and tags
    Click to Enlarge
  • Add translations to custom registered post types:
    qTranslate Slug Plugin - Settings option for post type example
    Click to Enlarge

    In the above screenshot, the post type named books has been registered (using the code below), so the translation fields are available for it. For more information about registering post types, check the Codex page for register_post_type function.

    The basic code example of registering books post type is as follows:

    function codex_custom_init() {
        $args = array(
          'public' => true,
          'label'  => 'Books'
        register_post_type( 'book', $args );
    add_action( 'init', 'codex_custom_init' );

    When no post types are registered, the post type option in the settings will contain no fields.

  • Change the way how the CSS styles for the qTranslate Slug "Flag Switcher Widget" are added.
    qTranslate Slug Plugin - Settings option for styles
    Click to Enlarge

    If you are already using qTranslate-X Flag switcher, we don't need these styles and can turn them off by choosing the last radio button none.

qTranslate Slug Widget

This addon also has its own widget Language selector (QTS) for displaying the Flag menu:
qTranslate Slug - Language selector QTS widget

The widget is very similar to the one from qTranslate-X, except it doesn't have the option for custom list format, so I prefer to use the qTranslate-X widget instead.

Note: If you want to customize the language menu from qTranslate-X plugin and show custom image flags, check my other article How To Customize Image Flags For Language Menu.

And now finally, let's explore, how to use the qTranslate Slug add-on.

Translating permalink (slugs) for each language in Posts and Pages

When editing a post or page, we will have an option named “Slug QTS” where we specify the permalink of the edited post / page for each language that is enabled by qTranslate-X:

qtranslate slug plugin editor option

For example, in the contact page, we would put these values:

qtranslate slug plugin editor option example

When English language is selected, we would get the following URL:

And for German language we get this:

And this is it. The permalinks will get translated to the currently selected language, so we are done.

They also get translated, when we have hard-coded links in our template. For example, if our contact page has page id of 12, the following code inside a template will display the contact link and it will get translated to the currently selected language:

<a href="<?php echo esc_url(get_permalink(12))."\">".get_the_title(12) ?></a>


With qTranslate Slug plugin add-on for qTranslate-X, we have the ability to translate permalinks / slugs for pages and posts in our multi-language website. In this article, we explored the various settings and widget and then we looked into how to use the add-on.

One Response

  1. Kyle
    October 8, 2019

Write a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.