Last active
January 31, 2021 20:15
-
-
Save yxod/6a7b043b9e7beaff9e619884655e822c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Change polylang code alternate | |
add_filter('pll_rel_hreflang_attributes', 'filter_pll_rel_hreflang_attributes', 10, 1); | |
function filter_pll_rel_hreflang_attributes($hreflangs) | |
{ | |
foreach ($hreflangs as $lang => $url) { | |
if ($lang == 'uk') { | |
$hreflangs['uk-UA'] = $hreflangs['uk']; | |
unset($hreflangs['uk']); | |
} else if ($lang == 'ru') { | |
$hreflangs['ru-UA'] = $hreflangs['ru']; | |
unset($hreflangs['ru']); | |
} | |
} | |
return $hreflangs; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment