Skip to content

Instantly share code, notes, and snippets.

@nicmare
Created March 20, 2026 12:09
Show Gist options
  • Select an option

  • Save nicmare/1ce471b85232527c5a2fb1519b7bfd3b to your computer and use it in GitHub Desktop.

Select an option

Save nicmare/1ce471b85232527c5a2fb1519b7bfd3b to your computer and use it in GitHub Desktop.
MU Plugin that prevents WordPress of creating .l10n.php files for specific textdomains
<?php
/**
* Plugin Name: LMDM Disable PHP Translation Cache for Selected Plugins
* Description: Forces WordPress to use .mo files instead of .l10n.php translation files for selected plugin textdomains.
* Author: Nic Bug / LMDM
* Version: 1.0.0
*/
defined('ABSPATH') || exit;
add_filter('translation_file_format', function ($preferred_format, $domain) {
static $domains = [
'soft-hyphen-inserter' => true,
'pdf-preview-inside-file-block' => true,
];
if (isset($domains[$domain])) {
return 'mo';
}
return $preferred_format;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment