How to Disable Specific Plugin Updates In WordPress

Disable plugin update WordPressAre you frustrated with several plugin updates and one that is a nuisance and you don’t want to update that plugin anymore? In WordPress, you can disable plugin update using a code snippet added to your theme or plugin file.

While there is probably a plugin to disable plugin update in WordPress, you may want to target a specific plugin and do it manually instead of using another plugin to disable the plugin of other plugins.

Reasons to Disable Plugin Update

There are several reasons why you may want to disable plugin update but some of the reasons include :

  • A bad update that breaks your site and has a conflict with other plugins or your WordPress theme.
  • If You like a feature in a plugin that is not available in the new update of the plugin – this is a common case especially when the WordPress plugin developer updates a plugin and removes some useful features. There is a specific example of the Google Analytics Dashboard plugin which was one of the most popular Google Analytics plugins that had over 1 million users and the update removed all the free good features and made them pro. If you still like that old plugin, I saved a copy for you and you can access the old plugin here.
  • When you have customized the plugin and no longer need updates from the plugin author
  • When you are simply annoyed by specific updates on a plugin that do not add any value to the form and functionality of a third party plugin.

Enough reasons why you may want to disable specific plugin updates. In this post, I  will share with you how to disable specific plugin updates without affecting the other plugins on your WordPress site.

Steps to Disable Specific Plugin Updates

  1. The first step is to know the plugin name and the main file name that you will use in the code. You can get this name from the plugin folder. You can see the name of the folder from the plugins directory as shown in the image below :disable plugin updates
  2. The second step is to create a filter hook that targets the 'site_transient_update_plugins' event and in the callback function, you will filter the specific plugin and use the unset function to remove the value of the updates of this specific plugin.
  3. Add the code snippet in funstions.php and update the theme file or plugin file and the plugin updates will be disabled.

 Disable Plugin Update Code Snippet

The following is the complete code snippet that you should add to the functions.php file of your active theme to disable plugin updates on your site.

/**
 * Disable Specific Plugin Updates 
 * Place in theme functions.php 
 */
add_filter( 'site_transient_update_plugins', 'disable_plugin_updates' );

function disable_plugin_updates( $value ) {
	
  if ( isset($value) && is_object($value) ) {
	  
    if ( isset( $value->response['plugin-folder/plugin.php'] ) ) {
		
      unset( $value->response['plugin-folder/plugin.php'] );
	  
    }
	
  }
  
  return $value;
}


In the code snippet, you need to replace the name of the main plugin file and the folders as it appears in these two lines :

if ( isset( $value->response['plugin-folder/plugin.php'] ) ) {

    unset( $value->response['plugin-folder/plugin.php'] );

}

Disable Multiple Plugin Updates

We can extend this code snippet further to accommodate more plugins and disable their updates. The code can have an array that gets all the plugins that you want to disable updates and then run the same filter as follows :

/**
 * Disable Multiple Plugin updates 
 * Place in theme functions.php 
 */

add_filter( 'site_transient_update_plugins', 'disable_multiple_plugin_updates' );

 function disable_multiple_plugin_updates( $value ) {

    $pluginsToDisableUpdates = [
        'plugin-folder/plugin.php',
        'plugin-folder2/plugin2.php',
		'plugin-folder3/plugin3.php',
		'plugin-folder4/plugin4.php',
		'plugin-folder5/plugin5.php'
    ];

    if ( isset($value) && is_object($value) ) {
        foreach ( $pluginsToDisableUpdates as $plugin) {
            if ( isset( $value->response[$plugin] ) ) {
                unset( $value->response[$plugin] );
            }
        }
    }
    return $value;
}

Conclusion

You can disable plugin updates using the code snippet shared above by adding it to the functions.php file of your WordPress theme. You can also disable multiple updates using the code above. Do not forget to change the names of the plugin folder and the main plugin file in the respective code snippets for this code to be effective.