Blog / WordPress

Hide Update Notifications for Individual WordPress Plugins

Hide Update Notifications for Individual WordPress Plugins

Although mod­i­fy­ing a WordPress plu­g­in direct­ly isn’t the first step you should take in cus­tomiz­ing your web­site, it is some­times nec­es­sary to edit or hack the code in WordPress plu­g­ins to cor­rect bugs, adjust func­tion­al­i­ty, remove over­ly zeal­ous alerts and nags such as “buy the pre­mi­um ver­sion” and “works best with our oth­er plu­g­ins”, or to change the out­put style, form, or func­tion. Modifying a plu­g­in makes it dif­fer­ent from its ver­sion in the WordPress Plugin Directory, thus trig­ger­ing WordPress to alert you that the plu­g­in needs to be updat­ed (rein­stalled) to match the Directory ver­sion. You can sim­ply ignore the update alerts, but most WordPress site own­ers, design­ers, and devel­op­ers have an ingrained, almost auto­mat­ic need to clear that per­sis­tent noti­fi­ca­tion of pend­ing updates from the admin bar .

Fortunately, there is a sim­ple way to tell WordPress to leave your mod­i­fied plu­g­ins alone and to stop alert­ing on them.

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

Figure 1: The Installed Plugins page entry for a plu­g­in I mod­i­fiedwith­out an update pend­ing alert.

Disabling Specific Plugin's Update Alerts

Add the fol­low­ing 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 mod­i­fied plugin’s direc­to­ry name and pri­ma­ry file name from with­in /wp-content/plugins/. For exam­ple, if you want­ed to stop alerts for mod­i­fi­ca­tions to Akismet, you’d set the val­ue to akismet/akismet.php, result­ing in the fol­low­ing line:

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

If you’ve mod­i­fied more than one plu­g­in, sim­ply add addi­tion­al 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 spec­i­fied plu­g­ins will dis­ap­pear from the Installed Plugins page, the WordPress Updates page, and the admin bar.

Code orig­i­nal­ly from StackExchange here.

Bonus Tip

If you do mod­i­fy your site’s WordPress plu­g­ins, do your­self a favor and note the mod­i­fi­ca­tion in the plugin’s head­er so that you can imme­di­ate­ly iden­ti­fy mod­i­fied plu­g­ins months or years from now. In the image below, for exam­ple, you can see how I’ve added an alert to a plu­g­in I mod­i­fied. That alert tells me—and more impor­tant­ly, my client—that I’ve mod­i­fied the plu­g­in from its orig­i­nal ver­sion. That notice implies that, should a new ver­sion of the orig­i­nal plu­g­in be released, the client shouldn’t update her installed ver­sion. Rather, she should con­tact me—or me or anoth­er WordPress developer—to migrate the mod­i­fi­ca­tions to the new ver­sion, if need­ed.

Inserting your mod­i­fied notices into the plugin’s head­er so that they appear on the Installed Plugins page is just a mat­ter of open­ing the plugin’s main file and edit­ing the first few lines as in the image below. Note that I always append PSB, my ini­tials, to the ver­sion num­ber as well as adding an alert to the Description field line. The ver­sion num­ber is the actu­al ver­sion of the plu­g­in, straight out of the repos­i­to­ry. To cre­ate my own ver­sion­ing, for exam­ple, to note that I’ve made mod­i­fi­ca­tions and then made fur­ther mod­i­fi­ca­tions, I’ll add ver­sion num­bers after my ini­tials in the Version field line.

Figure 2: Editing the header information for a plugin.

Figure 2: Editing the head­er infor­ma­tion for a plu­g­in.

2 Responses

  1. Toren says:

    Valuable infor­ma­tion for the devel­op­ers to dis­able the spe­cif­ic plugin’s update alerts.

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

    Thanks for shar­ing

  2. I’m glad it helped you.

Leave a Reply

%d bloggers like this: