How to Disable Updates for a Specific WordPress Plugin Using Custom Code

WordPress plugins often undergo updates to enhance functionality, security, and compatibility. However, there are instances when you may need to disable updates for a specific plugin, perhaps due to compatibility issues with your theme or other plugins, or because you've made customizations to the plugin that would be overwritten by an update. Fortunately, you can achieve this by implementing custom code in WordPress. Below, we'll guide you through the process step by step.

Step 1: Identify the Plugin Slug

Every WordPress plugin has a unique identifier called a "slug." You'll need to find the slug of the plugin you want to disable updates for. You can typically find this by navigating to the Plugins page in your WordPress admin dashboard and locating the plugin. The slug is usually the last part of the plugin's URL when viewed on the Plugins page.

Step 2: Access Your WordPress Theme's Functions.php File

To add custom code to disable updates for a specific WordPress plugin, you'll need to access your theme's functions.php file. This file contains functions and code snippets that can modify various aspects of your WordPress site's functionality.

  1. Log in to your WordPress admin dashboard.

  2. Navigate to Appearance > Theme Editor.

  3. Find and click on the "Theme Functions" (functions.php) file on the right-hand side.

Step 3: Add the Custom Code

Once you've opened the functions.php file, you can add the custom code to disable updates for the specific plugin. Below is an example of the code you can use:

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

Replace 'plugin-folder/plugin-file.php' with the actual folder and file name of the plugin you want to disable updates for. For example, if the plugin's folder is named example-plugin and the main plugin file is example-plugin.php, the code would look like this:

function disable_plugin_updates( $value ) {
    if ( isset( $value->response['example-plugin/example-plugin.php'] ) ) {
        unset( $value->response['example-plugin/example-plugin.php'] );
    }
    return $value;
}
add_filter( 'site_transient_update_plugins', 'disable_plugin_updates' );

Step 4: Save Your Changes

After adding the custom code to the functions.php file, make sure to save your changes.

Step 5: Verify

To verify that the updates for the specific plugin have been disabled, you can navigate to the Plugins page in your WordPress admin dashboard. You should no longer see update notifications for the plugin you've targeted with the custom code.

By following these steps and implementing custom code in your WordPress theme's functions.php file, you can effectively disable updates for specific plugins, providing more control over your WordPress site's maintenance and customization. Remember to proceed with caution when modifying theme files, and always make backups before making changes.