Blog / WordPress

Hide Update Notifications for Individual WordPress Plugins

Hide Update Notifications for Individual WordPress Plugins

Although modifying a WordPress plugin directly isn’t the first step you should take in customizing your website, it is sometimes necessary to edit or hack the code in WordPress plugins to correct bugs, adjust functionality, remove overly zealous alerts and nags such as “buy the premium version” and “works best with our other plugins”, or to change the output style, form, or function. Modifying a plugin makes it different from its version in the WordPress Plugin Directory, thus triggering WordPress to alert you that the plugin needs to be updated (reinstalled) to match the Directory version. You can simply ignore the update alerts, but most WordPress site owners, designers, and developers have an ingrained, almost automatic need to clear that persistent notification of pending updates from the admin bar .

Fortunately, there is a simple way to tell WordPress to leave your modified plugins alone and to stop alerting on them.

Figure 1: The Installed Plugins page entry for a plugin I modified.

Figure 1: The Installed Plugins page entry for a plugin I modified–without an update pending alert.

Disabling Specific Plugin’s Update Alerts

Add the following code to the functions.php file in your theme or child theme.

/*-*/
/* Stop WP from alerting to updates or version mismatches in modified plugins  */
/*-*/

function filter_plugin_updates( $value ) {
    unset( $value->response[‘pluginfolder/pluginfile.php'] );
    return $value;
}
add_filter( 'site_transient_update_plugins', 'filter_plugin_updates' );

Replace pluginfolder/pluginfile.php with your modified plugin’s directory name and primary file name from within /wp-content/plugins/. For example, if you wanted to stop alerts for modifications to Akismet, you’d set the value to akismet/akismet.php, resulting in the following line:

    unset( $value->response[‘akismet/akismet.php’] );

If you’ve modified more than one plugin, simply add additional unset lines like below.

/*-*/
/* Stop WP from alerting to updates or version mismatches in modified plugins  */
/*-*/

function filter_plugin_updates( $value ) {
    unset( $value->response[‘pluginfolder1/pluginfile1.php'] );
    unset( $value->response[‘pluginfolder2/pluginfile2.php'] );
    unset( $value->response[‘pluginfolder3/pluginfile3.php'] );
    return $value;
}
add_filter( 'site_transient_update_plugins', 'filter_plugin_updates' );

Save your functions.php file, and all update alerts for the specified plugins will disappear from the Installed Plugins page, the WordPress Updates page, and the admin bar.

Code originally from StackExchange here.

Bonus Tip

If you do modify your site’s WordPress plugins, do yourself a favor and note the modification in the plugin’s header so that you can immediately identify modified plugins months or years from now. In the image below, for example, you can see how I’ve added an alert to a plugin I modified. That alert tells me—and more importantly, my client—that I’ve modified the plugin from its original version. That notice implies that, should a new version of the original plugin be released, the client shouldn’t update her installed version. Rather, she should contact me—or me or another WordPress developer—to migrate the modifications to the new version, if needed.

Inserting your modified notices into the plugin’s header so that they appear on the Installed Plugins page is just a matter of opening the plugin’s main file and editing the first few lines as in the image below. Note that I always append PSB, my initials, to the version number as well as adding an alert to the Description field line. The version number is the actual version of the plugin, straight out of the repository. To create my own versioning, for example, to note that I’ve made modifications and then made further modifications, I’ll add version numbers after my initials in the Version field line.

Figure 2: Editing the header information for a plugin.

Figure 2: Editing the header information for a plugin.

2 Responses

  1. Toren says:

    Valuable in­for­ma­tion for the de­vel­op­ers to dis­able the spe­cif­ic plugin’s up­date alerts.

    As a de­vel­op­er your blog will helps me alot.

    Thanks for sharing

  2. I’m glad it helped you.

Leave a Reply

%d bloggers like this: