Disable WordPress Plugin Update Notification

WordPress automatically checks for any plugin update and notification are displayed on the plugin page which asks you to view the version change log or update the plugin. “There is a new version of XYZ plugin available”. This message is so familiar to WordPress admin. If you ignore these updates, the notifications can pile up.

WordPress Plugin Update Notification

WordPress Plugin Update Notification

I’m definitely an advocate of updating plugins when a newer version comes out. Plugin developers are constantly fixing bugs, closing security gaps, increasing efficiency, and updating other aspects of the plugin that will benefit your site. But sometimes, we need to turn it off. For example, I just customized a plugin, and don’t want my customization code being overwritten by anyone who doesn’t know this plugin has to be remain untouched. This is useful when you are designing a website and customized plugin for clients. You don’t not want them to update the plugin which may break the site.

Here are 3 simple ways to hide the plugin update notification.

Option 1 – Modify Plugin Version

The easiest solution is to open up the PHP file in the plugin root directory and modify the version number. At the top of the file, there will be some commented out variables that WordPress pulls in.

Change Version Number

Change Version Number

By updating the plugin version here to a higher number, you can suppress the update notification.

One quick note about this solution – it’s not a complete solution. You can update the plugin version from 3.0 to 3.1 but as soon as 3.2 comes out you’ll get the notification again. You could put a version number so high that the plugin will never get there, for example 999.0.

Option 2 – Prevent Update Notification

The method I prefer is to use the function I’ve written out below to suppress the update notification. WordPress makes it’s rounds and searches for plugins to be updated, and we can get rid of the notification by removing the plugin from the array.

Solution 1: – http_request_args hook

// Disable plugin update check
function haloseeker_prevent_update_check($r, $url) {
    if (0 === strpos($url,'http://api.wordpress.org/plugins/update-check/')){
        $my_plugin = plugin_basename(__FILE__);
        $plugins = unserialize($r['body']['plugins']);
        unset($plugins->plugins[$my_plugin]);
        unset($plugins->active[array_search($my_plugin, $plugins->active )]);
        $r['body']['plugins'] = serialize($plugins);
    }
    return $r;
}
add_filter('http_request_args', 'haloseeker_prevent_update_check', 10, 2);

This code snippet hooks into http_request_args and remove the plugin from the query arguments passed in the http request. Therefore, this code snippet must be inserted into the very plugin we want to disable the update check.

In case there are more than one plugin we want to disable update check, we need to insert this snippet into each plugin. And make sure we use a different function name in different plugin (also update the function name in the add_filter line). (i.e. haloseeker_prevent_update_check_xxx instead of haloseeker_prevent_update_check)

Solution 2: – site_transient_update_plugins hook

// Disable plugin update check
function disable_filter_plugin_updates($value) {
    unset($value->response['plugin_folder/plugin.php']);
    return $value;
}
add_filter('site_transient_update_plugins', 'disable_filter_plugin_updates');

This solution is simpler yet more powerful. To use it, we can drop this into either function.php, or our own plugin (my favorite). Just remember to replace the ‘plugin/plugin.php’ in line 3 with the actual plugin path and main php file anme. For example: using

akismet/akismet.php

will stop WordPress from checking update for plugin Akismet.

To disable update check on more plugins, simply declare each plugin using the same unset() function. For example: following code will stop update check on Akismet & All in one Seo pack.

// Disable plugin update check
function disable_filter_plugin_updates($value) {
    unset($value->response['akismet/akismet.php']);
    unset($value->response['all-in-one-seo-pack/all_in_one_seo_pack.php']);
    return $value;
}
add_filter('site_transient_update_plugins', 'disable_filter_plugin_updates');

Option 3 – Use Plugin Disable All WordPress Updates

Disable All WordPress Updates Plugin will helps you do that. This plugin completely disables the theme, plugin and core update checking system in WordPress. The plugin prevents WordPress from checking for updates including cronjobs, and prevents any notifications from being displayed.

This plugin combines und extends these three plugins:

It’s very important that you keep your WordPress theme, core and plugins up to date. If you don’t, your blog or website could be susceptible to security vulnerabilities or performance issues.

If you use this plugin, make sure you keep yourself up to date with new releases of your active WordPress version, plugins and themes and update them as new versions are released (simply by deactivating this plugin for a short time).

Summary

While suppressing the plugin update notifications is a nice touch, choosing to ignore plugin updates could result in security issues for your site. Old and outdated plugins are often the cause of sites being hacked, so it’s strongly advised that you update plugins with newer versions when they become available.

Leave a Reply

avatar
  Subscribe  
Notify of