Skip to content

Instantly share code, notes, and snippets.

@seebz
Created September 12, 2012 12:33
Show Gist options
  • Save seebz/3706322 to your computer and use it in GitHub Desktop.
Save seebz/3706322 to your computer and use it in GitHub Desktop.
WP: Empêche la mise à jour des plugins modifiés
<?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