How to disable plugin update notification for a specific plugin in Multisite

How it is possible to disable plugin update check and notification for an custom specific plugin in WP Multisite.

I think it is also important, the plugin is usable as single activation in each blog of network and also as network wide active plugin. The check is different on an activation on single blog in the network of WP mu.

Read More

Background: I write many plugins for customers and in all plugins I deactivate the the checkup and notification with the follow solution (its als othe same from this question no 20580). But this works only on an single install of WordPress, not on a Multisite install. The filter works only a blog inside the network.

If you are inside the backend of network, than run the check again about all plugins, also the plugin which this source.

Maybe other people have the same requirement or/and a solutions, thanks.

add_filter( 'site_transient_update_plugins', array( $this, 'remove_update_nag' ) );
/**
 * Disable plugin update notifications
 * 
 * @param  array string $value
 * @since  1.2.3
 * @link   http://dd32.id.au/2011/03/01/disable-plugin-update-notification-for-a-specific-plugin-in-wordpress-3-1/       
 * @retrun array string $value
 */
public function remove_update_nag( $value ) {

    if ( isset( $value ) && is_object( $value ) )
        unset( $value->response[plugin_basename(__FILE__)] );

    return $value;
}

Related posts

Leave a Reply

3 comments

  1. Even more easy:
    open up the specific plugin directory;
    find the php file in which the version of the plugin is mentioned;
    change the version number to a high number (i.e. Version 1.1 to Version 100.1)

  2. I have found a solution for me. Create a plugin, active in network – network wide. This is important on a mu install. If the check only in a plugin, there is active in a blog of a mu install, then was the check only active in this blog and the update check and notice was active in the network.

    Define the plugins, there you will not check for update in the array of var $blocked_plugins.

    <?php
    /**
     * Plugin Name: Plugin updates blocker
     * Plugin URI:  
     * Description: Disable plugin update check for specific plugins list
     * Version:     1.0.0
     * Author:      Frank Bültge
     * Author URI:  http://bueltge.de
     * License:     GPLv3
     */
    
    ! defined( 'ABSPATH' ) and exit;
    
    add_filter( 'http_request_args', 'fb_block_update_specific_plugins', 5, 2 );
    function fb_block_update_specific_plugins( $r, $url ) {
    
        //var_dump( unserialize( $r['body']['plugins'] ) );
    
        if ( 0 !== strpos( $url, 'http://api.wordpress.org/plugins/update-check' ) )
            return $r;
    
        // array for the plugin slug - folder/file
        $blocked_plugins = array(
            'oembed-gist.php', // plugin without folder
            'subtitle/class-post_subtitle.php',
            'wp-slabText/wp-slabtext.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;
    }
    
  3. use the below code in your functions.php

    function jm_update_notice()
    {
    remove_action( 'load-update-core.php', 'wp_update_plugins' );
    }
    add_filter( 'pre_site_transient_update_plugins', '__return_null' );