“the j stands for Jessant”
about me | research blog | wordpress plugins | jQuery plugins

10 January, 2010

qTranslate and multilingual META tags

I use WordPress with qTranslate, but I needed to have multilingual META tags which qTranslate doesn’t support – so I wrote a plugin to do the job myself. It’s pretty basic, but I thought I would share in case anyone else needs something similar.

Plugin can be found on WordPress’ Plugin site here: qTranslate Meta at WP Plugin Directory.

For users of qTranslate META 0.9.1 and older, to make the plugin work on a “static” homepage you should change the title hook used from single_post_title to wp_title (in qtranslate-meta.php, line 29). As of version 1.0.0, you can now set this directly from the plugin’s setting page, without having to edit any PHP code.


I’d like to thank the following people for their contributions (in chronological order):

  • Victor Berchet — Help with initial localisation; French translation
  • Benoit Gauthier — autosave bug fix
  • Filippo Pisano — Italian translation
  • Marcis G. — Belorussian translation
  • Almaz — Russian translation
  • Renate Kramer — German translation
  • Rene — Dutch translation


  1. Yes! I now have a title on the homepage, which is quite important ! Thanks a lot!

    Regarding the porfolio, it must have been added by the theme that i am using : perfekto
    i’ll to find a way. Thanks again !

    Comment by herbertwest — 9 January, 2012 @ 1:34 pm

  2. Hello,
    Also I use WordPress with qTranslate and I think this plugin it is awesome.
    I need to find how to enable the qTranslate QuickTags as:
    [:en]John[:es]Juan or also <!--:en-->John<!--:--><!--:es-->Juan<!--:-->
    in my Comments area. Does anyone know how to do this?
    I can’t figure out why they don’t work. Probably need some extra code in my templates files (Magazine-Basic). I thought that these QuickTags were good to get separate comments for each language, and I don’t understand why they are not able to do it. I tried to put the QuickTag in my comments area, above the content but they didn’t work.
    Please can someone help me figure out how to enable this for each comment?

    Comment by Helga — 11 February, 2012 @ 2:55 am

  3. Hi Helga,
    You will likely need to edit some PHP in your template to get that working. It might be as simple as passing your comment text through the _ẹ() function, or you might need something more manual like this:

    if (!function_exists('qtrans_getLanguage')) {
    $lang = qtrans_getLanguage();
    $translations = qtrans_split( $comment );
    echo $translations[$lang];

    I guess this should be implemented as a filter on the comments, e.g. using the comment_text filter hook. You can find the documentation for the qTranslate functions here.
    Hope that helps!

    Comment by John — 13 February, 2012 @ 10:08 am

  4. Hi John,
    just installed your plugin and have the following problem, using
    Theme Twenty Ten 1.2
    qtranslate 2.5.24
    qtranslate META 0.9.1

    The title does not change with the language and I don’t know how to do this.
    I had installed before All in one SEO, but deactivated it, before installing qtranslate META.

    I read the whole thread, but couldn’t find anything. As well I changed the line 29 into wp_title,
    but still get the same result, the title only changes from …../blog/title to …../blog/es/title or …..blog/de/title,
    but not changing the title by itself.

    As I am new to this whole internet marketing stuff, maybe this is a stupid question, but even though would apreciate some info.
    Oh yes, site is set to begin with static page and I see a permalink(but if I change this permalink i can’t see anything)

    Thanks in advance


    Comment by Olaf — 6 March, 2012 @ 11:38 am

  5. Hi,
    Is it possible to please tell us which code to hook in the functions.php or wherever in order to make this work with custom post types & taxonomies?
    The tragedy is that qtranslate itself supports them out of the box, your plugin unfortunatelly NOT! (and as you see, the issues comes up again & in the above comments).
    Telling us we should investigate it ourselves is cute, but unfortunatelly useless 🙁
    If we were programmers, guess we wouldn’t have needed a plugin in 1st place, so your feedback, as developer of this plugin is crucial.


    Comment by candy — 5 May, 2012 @ 4:06 pm

  6. OK, foundt it 🙂 – bless these guys here:

    So if you need to apply multilingual meta-tags to your custom post-types, add this to your functions.php :

    if ( is_admin() && function_exists(“qtrans_getSortedLanguages”) ) {
    add_action(‘admin_menu’, ‘enable_qTranslate_Meta’);
    function enable_qTranslate_Meta()
    global $qtransMETA;

    $post_types = get_post_types();
    /* post and page types are already processed by the plugin */
    $disabled_types = array( ‘post’, ‘page’, ‘attachment’, ‘revision’, ‘nav_menu_item’ );
    $enabled_types = array_diff( $post_types, $disabled_types );

    if ( $enabled_types ) {
    foreach( $enabled_types as $enabled_type ) {
    ‘qtrans_meta_meta_box’, //HTML id
    __(‘Multilingual META’, ‘qtranslate-meta’), //title
    array(&$qtransMETA, ‘meta_box_generate’), //callback
    $enabled_type, //type
    ‘normal’, //context – normal, advanced, side
    ‘high’ //priority – high, low

    Good luck 🙂

    Comment by candy — 5 May, 2012 @ 4:15 pm

  7. qTranslate META does not change “Title” tag for a static front page! It’s just empty 🙁

    Comment by Ruslan — 2 June, 2012 @ 4:24 pm

  8. I solved it by filling title field in Yoast SEO, but this way I have only English title for all languages, what it not the best solution 🙁

    Comment by Ruslan — 2 June, 2012 @ 7:21 pm

  9. Only “For users of qTranslate META 0.9.1 and older, to make the plugin work on a “static” homepage you should change the title hook used from single_post_title to wp_title (in qtranslate-meta.php, line 29).” helped me on version 1.0.0!!!!!!!!

    Comment by Ruslan — 16 June, 2012 @ 5:11 pm

  10. hi there!
    great plugin! i have one small problem – maybe i oversee something, but i get the meta tags of the first post also in the category and tag pages which leads to double content. is there an easy way to avoid this (if … remove_action)?
    thanks for your work and help!

    Comment by patricio — 25 June, 2012 @ 5:25 pm

  11. Hi Patricio,
    Yes this is a very good point. I think I know the solution: place the following line in your qtranslate-meta.php file, in the beginning of the hook_head function (line 163):

    if (!(is_single() || is_page())) return;

    Let me know if this works correctly, and I will push it as an update to the plugin.

    Comment by John — 27 June, 2012 @ 9:20 am

  12. perfect! thanks a lot!!! that did the job with just one line of code 🙂

    Comment by patricio — 27 June, 2012 @ 10:44 am

  13. Google does not index the text in the Description and Keywords. Why?
    Text in Russian. But it is obvious that he is different.

    Comment by Eugen — 18 September, 2012 @ 1:54 am

  14. We can’t control what Google does Eugen! It is almost agreed that META tags are useless when it comes to SEO anyway; since they are so easily abused, many say that the major search engines to do not even pay attention to them.

    Comment by John — 18 September, 2012 @ 7:20 am

  15. I do not understand. Why do I need your plugin?
    Can I remove the plugin? It can not hurt to index blog?

    Comment by Eugen — 18 September, 2012 @ 3:40 pm

  16. It depends on why you want meta tags in the first place, and that’s not up to me to decide for you. If meta tags are not important to you, then yes you should remove this plugin.

    Comment by John — 18 September, 2012 @ 4:55 pm

  17. Hi, I am having two problesm here.
    1) Titles in different languages are not in the source code of no pages, but Descriptions are
    2) Descriptions are in the source code twice, both called meta name=”description” content=””: the fist occurrence of the meta description is that of the main language of the site, the second is that of the language of the page. I need to mainly solve the title issue, but even the second would be appreciated.
    Here is what I have on my WP site:
    Site based on twenty eleven child (the child is just changed in the CSS for background colours and fonts)
    Static Pages as main
    YOAST SEO, set to rewrite title, and title taxonomy is %%title%% (but this should not affect anything because it is rewritten)
    (I also tried to disable the rewrite, but a lot of duplications in one sinngle meta title occurrs so I have all the languages one after the other, + the title of the site. Also tried WITHOUT the rewrite and WITHOUT the %%title%% taxonomy, nothing changed, and also emptying all the SEO TITLES fields… in the latter case the result was all the page titles in all the languages one after the other)
    QTranslate Meta with settings to wp_title in the hook
    General settings title of the blog st up with [:en] xxxxxxx [:ru] yyyyyyy etc and that part works in the body but NOT IN THE META
    I tried all the solutions suggested in the thread but none worked.
    Please help me 🙂

    Comment by efffetti — 9 November, 2012 @ 3:23 pm

  18. It’s difficult for me to tell what’s going on without seeing your source code, but this sounds like to me like a conflict between your other SEO plugin and qTranslate META. As stated on the plugin homepage, I have not tested the plugin with any other SEO plugin and do not intend to.
    I can’t solve your problem directly, but perhaps trying the following may give you some clues:

    1. Look in your database to see if the META information is saved correctly. Look at the table wp_postmeta, where the meta_key column begins with qtrans_meta:. This is kindof low-level but will help establish if the meta information itself has become corrupted.
    2. Create a local duplicate of the site (and database), completely uninstall the other SEO plugin, use a default theme with no customisations, and see what happens then.

    The qtranslate META plugin itself is not that complicated, and you will probably be able to figure out what it’s doing by looking at the qtranslate-meta.php. Debugging WordPress loop stuff can be a hassle because you never know where hooks are being registered, and in which order they’re firing. There are WordPress plugins for helping with this, but in general it means getting very in depth and truly understanding what’s going on. It’s difficult to provide a quick solution in cases like these.

    Comment by John — 9 November, 2012 @ 8:00 pm

Leave a comment