Last active
March 24, 2018 14:00
-
-
Save dougwollison/1f977191ea1e5612f01d7988f67ec0d7 to your computer and use it in GitHub Desktop.
A fix for nLingual to ensure localized URLs have any extras on the end preserved.
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 | |
/* | |
Plugin Name: nLingual localize_here() fix | |
Description: A fix for nLingual to ensure localized URLs have any extras on the end preserved. | |
Version: 1.0.0 | |
Author: Doug Wollison | |
Author URI: http://dougw.me | |
License: GPL2 | |
*/ | |
function nlingual_localize_here_with_postfix( $url ) { | |
// If the localized URL starts the same as the original but with possible tailing additions, revert to the original | |
if ( strpos( NL_ORIGINAL_URL, $url ) === 0 ) { | |
$url = NL_ORIGINAL_URL; | |
} | |
return $url; | |
} | |
add_filter( 'nlingual_localize_here', 'nlingual_localize_here_with_postfix', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment