Lego2012
12/13/2016 - 10:07 AM

Disable Update Check and Notification for Specific Plugin

Disable Update Check and Notification for Specific Plugin

<!-- http://wpcodesnippet.com/disable-update-check-notification-for-specific-plugin/ -->

<!-- Disable Update Check and Notification for Specific Plugin -->
function wcs_disable_plugin_update_check( $r, $url ) {
    if ( 0 !== strpos( $url, 'http://api.wordpress.org/plugins/update-check' ) )
        return $r;

    <!-- array of the plugins -->
    $blocked_plugins = array(
        'akismet/akismet.php',
        'contact-form-7/wp-contact-form-7.php',
    );

    if ( 0 === (int) count( $blocked_plugins ) )
        return $r;

    $installed_plugins = unserialize( $r['body']['plugins'] );
    foreach( $blocked_plugins as $p ) {
        unset( $installed_plugins->plugins[ $p ] );
        unset( $installed_plugins->active[ array_key_exists( $p, $installed_plugins ) ] );
    }
    $r['body']['plugins'] = serialize( $installed_plugins );

    return $r;
}
add_filter( 'http_request_args', 'wcs_disable_plugin_update_check', 5, 2 );