WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
Adding tags to article don't get the default language, disappears (22 posts)

  1. Otto Kekäläinen
    Member
    Posted 2 years ago #

    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/

  2. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  3. Otto Kekäläinen
    Member
    Posted 2 years ago #

    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?

  4. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    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 ?

  5. Otto Kekäläinen
    Member
    Posted 2 years ago #

    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.

  6. Otto Kekäläinen
    Member
    Posted 2 years ago #

    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.

  7. Otto Kekäläinen
    Member
    Posted 2 years ago #

    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.

  8. Otto Kekäläinen
    Member
    Posted 2 years ago #

    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?

  9. Otto Kekäläinen
    Member
    Posted 2 years ago #

    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)

  10. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  11. Otto Kekäläinen
    Member
    Posted 2 years ago #

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

  12. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

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

  13. Robert Novak
    Member
    Posted 2 years ago #

    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

  14. Robert Novak
    Member
    Posted 2 years ago #

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

    Any idea?

  15. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  16. Robert Novak
    Member
    Posted 2 years ago #

    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.

  17. Robert Novak
    Member
    Posted 2 years ago #

    Just one more thing!

    I realized that the same problem arises in Published box (cant edit date post, visibility and status), Featured Image, Categories, Tags and even in the Screen option (cant pull down the options).

    It`s look like some Javascript issues.

    Just a hint!

  18. Robert Novak
    Member
    Posted 2 years ago #

    And yes!

    Problem solved by editing admin.js.... I took the uncompressed version of javascript from PL 0.6.1. version .

    Of course this is not long-term solution, but at least now I can edit posts!

  19. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    I did not notice you are using WP 3.1 before now. I reproduced the bug with this version of WP (the bug does not exist in WP 3.3). Hopefully it should be corrected in 0.8.4.

  20. Otto Kekäläinen
    Member
    Posted 2 years ago #

    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.

    I havn't tried the dev version yet. I'm not sure if I can, where is only one production instance. Is the dev version stable for sure?

    The fix i described worked fine, so I'm in no hurry to install new version of Polylang:

    I added this to the beginning of save_term():
    $this->set_term_language($term_id, $_POST['post_lang_choice']);

    I don't have the same symptoms as Revolter describes, probably not the same bug here.

  21. Robert Novak
    Member
    Posted 2 years ago #

    I just want to notice that a new version of PL 0.8.5 solved all my issues!

    Thanks Chouby for your support!

    I'm going to donate you for this great plugin!!! ;-)

  22. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    @ Otto
    Yes. There were two different bugs. v0.8.5 includes the modification you proposed ;-) And for now the dev version and v0.8.5 are the same.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags