• 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.

    http://wordpress.org/extend/plugins/polylang/

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

    (@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.

    Thread Starter Otto Kekäläinen

    (@ottok)

    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

    (@chouby)

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

    else
    			$this->delete_term_language($term_id);

    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 ?

    Thread Starter Otto Kekäläinen

    (@ottok)

    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.

    Thread Starter Otto Kekäläinen

    (@ottok)

    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.

    Thread Starter Otto Kekäläinen

    (@ottok)

    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.

    Thread Starter Otto Kekäläinen

    (@ottok)

    This is where the code seems to abort:

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

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

    Thread Starter Otto Kekäläinen

    (@ottok)

    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

    (@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.

    Thread Starter Otto Kekäläinen

    (@ottok)

    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):
    addthis
    adhesive
    akismet
    all-in-one-seo-pack
    auto-post-thumbnail
    category-posts
    category-radio-buttons
    clickpass
    contact-form-7
    contact-form-7-recaptcha-extension
    db-cache-reloaded-fix
    events-manager
    f18ImageGallery
    facebook-fan-box
    featured-image-in-rss-feed
    flickrpress
    free-stock-photos-foter
    gecka-submenu
    google-authorship-widget
    google-calendar-widget
    google-sitemap-generator
    host-meta
    hyper-cache
    lightbox-2
    mobileOKPythia
    mowser-wordpress-mobile
    multi-feed-reader
    my-youtube-playlist
    openid
    pageear
    page-links-to
    photo-dropper
    polylang
    popular-widget
    publish-to-facebook
    share-on-facebook
    surveys
    trust_xhtml.php
    twitter-widget-pro
    well-known
    wind_harmaja
    wordpress-google-calendar
    wordpress-mobile-pack
    wordpress-mobile.php
    wot-for-blogs
    wp-e-commerce
    wp-geo
    wp-google-analytics
    wp-infocard
    wp-optimize
    wp-polls
    wp-recaptcha
    wp-rss-multi-importer
    wp-socializer
    wp-super-cache
    xrds-simple

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

    Plugin Author Chouby

    (@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

    (@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 (0.8.3.9) 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.