Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

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;
}
share|improve this question

2 Answers 2

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' ); 
share|improve this answer
    
But this source don' work for an specific plugin. I will not disable all plugins, only an specific plugin. –  bueltge Jul 31 '12 at 11:09
    
Also, don't return null to pre_site_transient_update_plugins, as it forces WP to check for updates every single request; see another answer about this on stackoverflow for more details and a better implementation. –  El Yobo Feb 18 '13 at 11:22
up vote 1 down vote accepted

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;
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.