Skip to content

Instantly share code, notes, and snippets.

@habibimroncn
Last active January 3, 2022 11:59
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save habibimroncn/974ac1a8380f5f1d72b5bfa57be3589f to your computer and use it in GitHub Desktop.
Save habibimroncn/974ac1a8380f5f1d72b5bfa57be3589f to your computer and use it in GitHub Desktop.
Get Current language on Polylang Plugin for Wordpress.

Reference for language code : Language Code

<?php 
$currLang = get_bloginfo('language');
if($currLang == "id-ID"){ // Replace condition with your language code.
	echo 'Bahasa Indonesia';
} else {
	echo 'up to you'
}
?>
@officialmmt
Copy link

officialmmt commented Nov 10, 2018

Thank you. You save my night. 👍 😄

@andyrojasc
Copy link

Thank you so much dude

@rainb3rry
Copy link

or you can browse these get_locale(), pll_current_language()

@simplenotezy
Copy link

@rainb3rry that's exactly what you need. get_bloginfo('language'); does not return the correct result, it always returns en-US for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment