The external links are detected for the possibility of changing the URL in a different language. If translating certain external links is not something needed, we can exclude specific domains from being detected by TranslatePress Multilingual by using the following approaches.
<a href="facebook.com" data-no-translation-href>My link</a>
/**
* You can add a new substring to be excluded by adding in the following code a new substring in the array $excluded_substrings (see the 'example.com' below)
* @param $substrings - array that contains already excluded substrings such as 'amazon-adsystem', 'googleads', 'g.doubleclick'
* @return array - the array that contains all the substrings, including the ones added in this function, that will be excluded from dynamic translation
*/
function trpc_add_new_substring_to_be_skipped_from_dynamic_translation($substrings){
$excluded_substrings = array( 'example.com', 'another-example.com' ); // add more here
$substrings['href'] = array_merge($excluded_substrings, $substrings['href']);
return $substrings;
}
add_filter( 'trp_skip_strings_from_dynamic_translation_for_substrings', 'trpc_add_new_substring_to_be_skipped_from_dynamic_translation', 10, 1);