Last active
February 28, 2020 07:41
-
-
Save Jehu/dbbe0f5832ebacbf4cbed142f16ba740 to your computer and use it in GitHub Desktop.
Set hreflang="x-default" for WP Globus WordPress Plugin
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
<?php | |
/* --------------------------------------------------------------------------- | |
* Set hreflang="x-default" with WP Globus | |
* --------------------------------------------------------------------------- */ | |
add_filter( 'wpglobus_hreflang_tag', 'custom_head_hreflang_xdefault', 10, 2 ); | |
function custom_head_hreflang_xdefault() { | |
$hreflangs = WPGlobus_Utils::hreflangs(); | |
$default_language = WPGlobus::Config()->default_language; | |
$hreflangs[ $default_language ] = str_replace( $default_language, "x-default", $hreflangs[ $default_language ] ); | |
return $hreflangs; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you @alexgff