How To: Disable Specific Plugin Updates

I was looking for a way to disable updates for specific plugins, especially a plugin I bought for a year, not really keen to continue paying for it as the updates weren’t that important. I did this with a simple code.

add_filter( 'site_transient_update_plugins', function( $value ) {
  $ignoredPlugins = [ 'affiliate-wp/affiliate-wp.php' ];
  if ( isset( $value ) && is_object( $value ) ) {
    foreach ( $ignoredPlugins as $plugin ) {
      if ( isset( $value->response[$plugin] ) ) {
        unset( $value->response[$plugin] );
      }
    }
  }
  return $value;
});

If you don’t know how to add custom code to WordPress, please check the artile about Add Custom PHP Code to WordPress.