Last active
April 11, 2024 10:44
-
-
Save timwhitlock/8d4d2fa35c0ab312d040223ef6990e5b to your computer and use it in GitHub Desktop.
Prevents WordPress from automatically updating translation files in the global languages directory
This file contains 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: Disable auto translation updates | |
Description: Prevents WordPress from automatically updating translation files in the global languages directory. | |
Author: Tim Whitlock | |
Version: 1.0 | |
*/ | |
/** | |
* https://developer.wordpress.org/advanced-administration/upgrade/upgrading/#configuration-via-filters | |
*/ | |
if( function_exists('add_filter') ){ | |
add_filter( 'auto_update_translation', '__return_false' ); | |
} |
The auto_update_translation
filter is documented as auto_update_{type}
https://developer.wordpress.org/reference/hooks/auto_update_type/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Placing this file in the mu-plugins directory will prevent WordPress auto updates from overwriting translation files in the global "languages" directory at
wp-content/languages
.This applies to core translations directly inside the folder, plus theme and plugin translations inside "languages/themes" and "languages/plugins" respectively.
Note that translation files inside the actual themes and plugins will be overwritten regardless.