Skip to content

Instantly share code, notes, and snippets.

@swoboda
Forked from r-a-y/bp-disable-translation.php
Last active September 6, 2023 09:06
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swoboda/85cb70e1112db23454e37a838e891fed to your computer and use it in GitHub Desktop.
Save swoboda/85cb70e1112db23454e37a838e891fed to your computer and use it in GitHub Desktop.
Disable automatic plugins translations by WordPress.org.
<?php
/*
Plugin Name: Disable Translation Updates
Description: Disables automatic plugins translations by WordPress.org.
Author: wpdesk
License: GPLv2 or later
*/
add_filter( 'auto_update_translation', 'wpdesk_disable_translation_updates', 10, 2 );
/**
* Disables automatic translations for plugins.
*
* @param bool $retval Whether to use automatic translations
* @param object $item Update object. Do fine-grained checks against $item->type and $item->slug.
* @return bool
*/
function wpdesk_disable_translation_updates( $retval, $item ) {
// Add plugin slugs to suit your neeeds
$plugins = array( 'wordpress-seo', 'buddypress' );
if ( 'plugin' === $item->type && in_array( $item->slug, $plugins ) ) {
return false;
}
return $retval;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment