Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Show default version if translation isn't found
<?php
add_filter('icl_ls_languages', 'wpml_ls_filter');
function wpml_ls_filter($languages) {
global $sitepress;
$default_url = $languages[$sitepress->get_default_language()]['url'];
foreach($languages as $lang_code => $language){
if($languages[$lang_code]['missing']==1){
$languages[$lang_code]['url'] = $default_url;
}
}
return $languages;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.