Support » Plugin: Polylang » [Plugin: Polylang] Adding tags to article don't get the default language, disappears

  • I have Polylang 0.8.3 installed and everything works great, except that when I edit an post and add tags, the tags disappear when I save the post.

    The tags table shows that the tags have been added to the database, but they lack any language. As they don’t have any language, Polylang seems to hide them.

    I can fix this by manually running manually in database:
    insert into wp_termmeta set term_id=219, meta_key="_language", meta_value=48;

    However this is still a bug and should work without the need to run SQL manually.

Viewing 15 replies - 1 through 15 (of 21 total)
  • Plugin Author Chouby


    I do not have such issue on my test site. Maybe are you messed by the synchronization process ? If you set ‘tag_en’ for your English post and then unset ‘tag_fr’, *translation* of ‘tag_en’ on your translated post then ‘tag_en’ is removed from your English post.

    However you can set a tag specific to a French post, provided that this tag has no English translation.

    It is also possible that there is a plugin conflict.

    I have still not managed to resolve this issue. I dont’ think there is any syncronization problem, as the tags disappear directly and there is nobody setting or unsetting any languages.

    A plugin conflict is possible, but I don’t have any plugins related to languages.

    How should I debug this? What if I add some print_r code into some page? What php file does the tag adding?

    I noticed that in settings the line ” There are posts, pages, categories or tags without language set. Do you want to set them all to default language ?” comes often up. How do I debug this? How is it possible in the first place that some content would _not_ get a language setting?

    Plugin Author Chouby


    Could you try removing lines 606 & 607 in polylang/include/admin-filters.php


    These lines were written because in older releases, there was an option allowing not always setting a language. Now, I do not support this anymore since it was a too buggy way to reach the desired feature (but still have to find a new way to display some posts in several languages as requested by some users).

    However, looking at your problem, I believe now that it may conflict with another plugin which, for some reasons, would save tags outside the WordPress form. I have to check again but I believe that the two lines can be removed safely in the next release. Could you tell me if it solves your issue ?

    I commented out those lines, but didn’t fix the bug. Still, in the post view when I add a new tag to an article, initially it shows in the tag list, but when I save the post, this newly added tag (and in fact old tags too) disappears with the result, that the saved is tagless.

    In the tags admin area I can see that the tags I added exists, but they have no language set.

    Thanks however for pointing out this file, I’ll try to read what is does and debug it.

    I noticed that when a post is open and a new tag is written in the “Tags” box, the tag exists only as html markup on the current page. Only then the user presses Publish or Save, the tag is actually processed.

    In this case the problem seems to be, that when the new tag is processed, it does not get set any language.

    I also noticed, that if in the Tags box i press “choose from frequent tags” link and the tag cloud appears, there are some tags listed twice. I checked from the source that their tag-id is identical, so they don’t exist twice, they simply get printed twice.

    The tag cloud on the Tag admin page is correct. Also if a add tags from the Tag admin page panel, they get a default language set correctly.

    I added some debug code to fuction
    function save_term($term_id, $tt_id, $taxonomy) {

    For example I do print_r($_POST) and it shows that when the post is saved, and there is a new tag, lines

    if (isset($_POST['term_lang_choice']) && $_POST['term_lang_choice'])
        $this->set_term_language($term_id, $_POST['term_lang_choice']);

    are not run, because there is no ‘term_lang_choice’ set (it does not exist in the POST).

    However, in the POST there are stuff like

    [post_lang_choice] => fi
    [post_tr_lang] => Array
           [en] =>

    What does ‘term_tr_lang’ stand for?
    What it ‘tr’ abbreviated from? I need to know it to understand the rest of the function’s code.

    This is where the code seems to abort:

    if (!isset($_POST['term_tr_lang']))

    ..and thus nothing is done. So what is the ‘term_tr_lang’ and what is it supposed to contain?

    I added this to the beginning of save_term():
    $this->set_term_language($term_id, $_POST['post_lang_choice']);
    ..and now the bug is mostly solved: tags added get a language and they presist!

    (only remaining thing is duplicates in the tag clound on the edit post page, but that is not a big deal)

    Plugin Author Chouby


    In fact, when you save a post, save_term should be called only for the *new* tags you add, not for existing tags. In that case $POST[‘term_lang_choice’] is defined thanks to javascript and thus, the language of the tag is saved. I wonder. Do you deactivate javascript ?

    Another possibility is still a plugin conflict. Due to the lack of filters in WP, I was forced to rewrite some functions link to the tag metabox. If another plugin does the same, you may get unexpected results, maybe such as duplicate tag cloud you just mentioned. And if the ‘other plugin’ acts before Polylang, it is possible that th hidden field containing ‘term_lang_choice’ is not added which could explain your issue.

    Nevertheless, I will go on working on this and try to improve the robustness.

    No, I don’t deactivate javascript.

    Could the root cause be this:

    [post_lang_choice] => fi
    [post_tr_lang] => Array
           [en] =>

    Is’t the key ‘en’ supposed to point to something? Now it is empy? Is there something missing from my database/settings?

    About plugin conflict: is there any usual suspects? Here is a list of installed plugins (but only 22 of them are activated):

    I don’t think any of them does anything to the tag box..

    Plugin Author Chouby


    [post_tr_lang] is the array of translations. [en] points to the English post id if it exists.

    It’s the first time your issue has been reported so I can’t know if it comes from a conflict with a plugin in your list. I know and tested a few, but not all.

    Same problem here!

    Everything is working perfect accept adding tags and adding featured image which cause to open on new page instead in overlay.

    I have wp 3.1.4 and latest PL

    tnx for your help

    Now I also realized that adding a new category is also disabled during Polylang is activated.

    Any idea?

    Plugin Author Chouby


    Most probably, when the problem arises, it does not work for all taxonomies. Could you try with the development version ? Hopefully it solves the issue.

    Development version ( not working neither.

    Maybe because of my php version on server (PHP 5.1.6.).

    Unfortunately, on that server I do not have opportunities to upgrade php and can not compel the client to change hosting.

    On my other hosting I have latest php and latest WP and everything is working perfect with polylang.

    I love this plugin a lot, but it seems like I’m cornered.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘[Plugin: Polylang] Adding tags to article don't get the default language, disappears’ is closed to new replies.