wordpress Polylang function pll_the_languages() return empty string and not the switcher?

2k views Asked by At

I have a problem showing the polylang switcher in my wordpress custom theme header.php.

$mlkLng = pll_the_languages();
var_dump( $mlkLng );

//this return a string(0) ""

I have 3 languages in my site i can see it with the function

var_dump( pll_languages_list());

returns,

array(3) { [0]=> string(2) "en" [1]=> string(2) "fr" [2]=> string(2) "es" }  

Cant find a work around ??

1

There are 1 answers

0
Tom Aigner On

I hope this is still relevant. For me the problem was that i didn't had any content for the languages, so I had to give an extra option to the pll_the_languages function for displaying the items even if they're empty -> array('hide_if_empty' => 0). It is set to 1 on default.