Skip to content

Instantly share code, notes, and snippets.

View banarsiamin's full-sized avatar
💭
happy

banarsiamin banarsiamin

💭
happy
View GitHub Profile
@banarsiamin
banarsiamin / script.php
Created June 9, 2021 12:35 — forked from vielhuber/script.php
get current language (with locale) #wpml #wordpress
<?php
// returns 'en'
apply_filters( 'wpml_current_language', NULL );
// returns 'en'
global $sitepress;
$lang = $sitepress->get_current_language();
// returns 'en' (deprecated, does also not work when you switched languages programmatically)
if(defined('ICL_LANGUAGE_CODE')) {