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!)

    <?php
    // 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>
    <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) {
                    printf(
                            "<option value='%s'%s>%s</option>\n",
                            esc_attr($language->slug),
                            $language->slug == $lang ? ' selected="selected"' : '',
                            esc_html($language->name)
                    );
            } ?>
            </select><br />
    </p>
    <div id="post-translations"><?php
    include(PLL_INC.'/post-translations.php'); // allowing to determine the linked posts ?>
    </div>

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

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

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