POLYLANG: Hide current language

You need to add the hide_current parameter to this function. And when you use plugin function in your code, be sure to check if function exists. If the plugin get disabled, your website will continue to work 🙂

function polylang_flags_shortcode() {
    ob_start();
    if(function_exists('pll_the_languages'))
    {
        echo '<ul class="polylang-flags">';
        pll_the_languages(array(
            'show_flags'    => 0,
            'show_names'    => 1,
            'hide_current'  => 1,
        )); 
        echo '</ul>';
    }
    return ob_get_clean();
}
add_shortcode('POLYLANG', 'polylang_flags_shortcode');

I also move the ul part !