Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 305
Ston Lkharbacha Avatar asked Nov 22 '25 07:11

Ston Lkharbacha


1 Answers

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.

like image 176
Tom Aigner Avatar answered Nov 24 '25 20:11

Tom Aigner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!