Support » Plugin: Polylang » [Plugin: Polylang] FIX: "Add New" post doesn't keep intended language

  • If you click “Add New” to add a new post in a desired language, the new post language metabox will still show the default language.

    This fix reads new_lang directly in the post-metabox.php file and sets properly (3 lines changed… do a diff!)

    // allowing to choose the post's language
    // NOTE: the class "tags-input" allows to include the field in the autosave $_POST (see autosave.js)
    <p><em><?php $post_type == 'page' ? _e('Page\'s language:', 'polylang') : _e('Post\'s language:', 'polylang');?></em></p>
    <?php  if (isset($_GET['new_lang'])) $lang = $_GET['new_lang']; ?>
    <select name="post_lang_choice" id="post_lang_choice"><?php
            if (PLL_DISPLAY_ALL) // for those who want undefined language
                    echo '<option value="0"></option>';
            foreach ($listlanguages as $language) {
                            "<option value='%s'%s>%s</option>\n",
                            $language->slug == $lang ? ' selected="selected"' : '',
            } ?>
            </select><br />
    <div id="post-translations"><?php
    include(PLL_INC.'/post-translations.php'); // allowing to determine the linked posts ?>

Viewing 1 replies (of 1 total)
  • Plugin Author Chouby


    Well it seems that it is a random bug as it works well on all my test sites. However I had some issues in the past with the direct comparison of language objects and modified tests to compare on language slugs instead just as you propose to do here. I forgot this one. I will fix that for the future release.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Polylang] FIX: "Add New" post doesn't keep intended language’ is closed to new replies.