Skip to content

Instantly share code, notes, and snippets.

@dougwollison
Last active March 24, 2018 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dougwollison/1f977191ea1e5612f01d7988f67ec0d7 to your computer and use it in GitHub Desktop.
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.
<?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