• Resolved loopforever

    (@loopforever)


    Hi,

    I want to prevent the plugin language file (files with po and mo extension) from updating automatically. Is there a hook or other way to do this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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.

    Thread Starter loopforever

    (@loopforever)

    Thank you I’m going to try this.

    You are most welcome if it fixed reply me ??

    Plugin Support mouli a11n

    (@mouli)

    @loopforever
    You can also prevent updates removing language files by placing the po and mo files in the wp-content/languages/plugins/ directory although be careful to name it correctly as detailed in this article:
    https://woocommerce.com/document/translate-woocommerce-extensions/#section-2

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Preventing the Update of the Plugin Language File’ is closed to new replies.