Created
September 12, 2012 12:33
-
-
Save seebz/3706322 to your computer and use it in GitHub Desktop.
WP: Empêche la mise à jour des plugins modifiés
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 | |
/** | |
* Empêche la mise à jour des plugins modifiés (identifié par un numéro de version contenant `modified`) | |
*/ | |
add_filter( 'pre_set_site_transient_' . 'update_plugins', 'dont_upgrade_modified_plugins' ); | |
function dont_upgrade_modified_plugins($value) | |
{ | |
if ( $value && isset($value->response) && $value->response) | |
{ | |
$wp_plugins = get_plugins(); | |
foreach($value->response as $k => $v) | |
{ | |
$version = $wp_plugins[$k]['Version']; | |
if (strpos($version, 'modified') !== false) | |
{ | |
unset($value->response[$k]); | |
} | |
} | |
} | |
return $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment