Created
March 20, 2026 12:09
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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