Yes, in WordPress, you can prevent the automatic update of language files (po and mo files) for a plugin by using the auto_update_translation filter. By setting this filter to false for the specific plugin, you can disable the automatic updates for its language files.Here’s an example of how you can achieve this:
function prevent_plugin_language_file_update($update, $plugin, $language) {
// Specify the plugin folder name for which you want to prevent language file updates
$plugin_folder = 'your-plugin-folder-name';
// Check if the plugin being updated matches the specified folder name
if (strpos($plugin, $plugin_folder) !== false) {
$update = false; // Disable automatic language file updates for the specified plugin
}
return $update;
}
add_filter('auto_update_translation', 'prevent_plugin_language_file_update', 10, 3);
In the code above, replace 'your-plugin-folder-name'
with the actual folder name of the plugin for which you want to prevent language file updates.
You can add this code to your theme’s functions.php
file or create a custom plugin for it. Once implemented, the specified plugin’s language files will no longer be automatically updated by WordPress.