Skip to content

Instantly share code, notes, and snippets.

@Shoora
Forked from andxbes/disable_load_mo_files.php
Created September 1, 2023 13:32
Show Gist options
  • Save Shoora/cddbd3a4fedabea23404b074f243247a to your computer and use it in GitHub Desktop.
Save Shoora/cddbd3a4fedabea23404b074f243247a to your computer and use it in GitHub Desktop.
Отключение переводов на рест запросах в wordpress
<?php
add_filter('override_load_textdomain', function ($result, $domain, $mofile ) {
$url = urldecode($_SERVER["REQUEST_URI"]);
if (
(function_exists('is_ajax') && is_ajax())
|| str_contains($url, 'wp-json/')
|| str_contains($url, 'ap-api/')
) {
$result = true;
//error_log('отключаем переводы' .' ' . $domain );
}else{
//error_log('Перевод получен');
}
return $result;
},99,3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment