How to Disable Update Check and Notification for Specific Plugin

disable-update-check

WordPress has a built-in feature to notify you when the update of a specific theme or plugin available by showing you a notification in the dashboard. But, there may be few cases when you do not want to see the update notification for a specific theme or plugin.

Also see: How to install WordPress Plugin

I recommend you to always update your WordPress theme and Plugins to keep your blog safe. Most of these updates offer regular security updates along with new features.

A few months back, I did some custom modification in a plugin as per my own requirements. So, I do not want to update this plugin to get new features as I already did modifications as per my need. There may be similar kinds of cases when you do not want to update a plugin.

TO disable the update check for a specific plugin, we will restrict the http request for plugins that we do not want to update. So, try this code and paste it in the functions.php file of your WordPress theme.

// 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 );

The above code disables the updates check for Akismet and Contact Form 7 plugins. You can modify this code to add paths of more plugins that you want to restrict for update check.

Source

Advertisement

Tags: |

Deepanker Verma is the founder of Techlomedia. He is a tech blogger, developer and gadget freak.


Similar Articles

0 Comments

Leave a comment

Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.

2020 UseThisTip | Part of Techlomedia Internet Pvt Ltd Developed By Deepanker