Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Plugin now works with GTranslate › Reply To: Plugin now works with GTranslate
Hi,
Thank you very much. I checked the source, but I don’t think I can incorporate that change – as it would break the redirection permalinks for every site where Gtranslate is not present. In cases where gtranslate is present, then I am not sure if the permalink is always used as in your case like: siteurl.com/language/ – it might be something else for different configurations(?), I’m not sure.
I can however add hooks/events to the upcoming release, to have access to the redirection URL on the fly. That allows changing it via a custom code placed into the functions.php file in your child theme directory.
After the next plugin release is ready (4.20, it should be 2-4 weeks), please place this code functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
add_action('wp_footer', 'asp_custom_js_hook');
function asp_custom_js_hook() {
?>
<script>
wp.hooks.addFilter('asp_redirect_url', 'asp', function(url){
return url.replace(
"gmoresearch.org/",
"gmoresearch.org/" + (document.querySelector("html").lang.indexOf("en") > -1 ? "" : document.querySelector("html").lang
));
}, 10);
</script>
<?php
}
That will permanently fix the issue in your case.