61

I've found a great plugin for WordPress under GPLv2 license and made a lot of changes in source code, plugin does something else now. I modified author (with original plugin author's credits), URL, version number (from xxx 1.5 to YYY 1.0).

Everything works great, but when WordPress checks for plugin updates it treats my plugin YYY 1.0 as xxx 1.0 and displays notification about available update.

My changed plugin YYY 1.0 was installed by copying files from my computer, not from WP repository.

What else do I have to change?

isherwood
  • 58,414
  • 16
  • 114
  • 157
pp_1
  • 762
  • 1
  • 7
  • 13

11 Answers11

72

Disable plugin update

Add this code in your plugin root file.

add_filter('site_transient_update_plugins', 'remove_update_notification');
function remove_update_notification($value) {
     unset($value->response[ plugin_basename(__FILE__) ]);
     return $value;
} 
benomatis
  • 5,536
  • 7
  • 36
  • 59
Kishan Chauhan
  • 1,216
  • 1
  • 12
  • 19
45

Put this code in the theme functions.php file. This is working for me and I'm using it. Also this is for specific plugin. Here you need to change plugin main file url to match to that of your plugin.

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

Here:

"facebook-comments-plugin" => facebook comments plugin folder name

"facebook-comments.php" => plugin main file.this may be different like index.php

Hope this would be help.

Ore4444
  • 9,119
  • 2
  • 23
  • 29
Sumith Harshan
  • 6,325
  • 2
  • 36
  • 35
33

The simplest and effective way is to change the version of the plugin which you don't want to get update. For an example if I don't want wptouch to get updated, I open it's defination file, which is like:

/*
    Plugin Name: WPtouch Mobile Plugin
    Plugin URI: http://www.wptouch.com/
    Version: 4.0.4

*/

Here in the Version change 4.0.4 to 9999 like:

/*
    Plugin Name: WPtouch Mobile Plugin
    Plugin URI: http://www.wptouch.com/
    Version: 9999

*/
Abhinav bhardwaj
  • 2,657
  • 25
  • 21
23

In the plugin file, there will be a function that will check for updates. The original author could have named this anything, so you will have to go through the code and check each function and what it does. I would imagine the function will be quite obvious as to what it does.

Alternatively you can add this to your plugin file:

add_filter( 'http_request_args', 'dm_prevent_update_check', 10, 2 );
function dm_prevent_update_check( $r, $url ) {
    if ( 0 === strpos( $url, 'http://api.wordpress.org/plugins/update-check/' ) ) {
        $my_plugin = plugin_basename( __FILE__ );
        $plugins = unserialize( $r['body']['plugins'] );
        unset( $plugins->plugins[$my_plugin] );
        unset( $plugins->active[array_search( $my_plugin, $plugins->active )] );
        $r['body']['plugins'] = serialize( $plugins );
    }
    return $r;
}

Credits: http://developersmind.com/2010/06/12/preventing-wordpress-from-checking-for-updates-for-a-plugin/

benomatis
  • 5,536
  • 7
  • 36
  • 59
danyo
  • 5,686
  • 20
  • 59
  • 119
  • 1
    Trvial, but I suspect Pete original code for this from Mark: http://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-from-update-checks/ – jb510 Jan 31 '14 at 04:20
18
add_filter('site_transient_update_plugins', '__return_false');

in function.php add above code and disable all plugins updates

victor
  • 181
  • 1
  • 2
  • This hide the available updates even on WP 6.0.2, just what I was looking for without install another plugin. Thanks. – junihh Sep 02 '22 at 15:11
6

Add this line to wp-config.php to disable plugin updates:

define('DISALLOW_FILE_MODS',true);
6

One easy solution was to change the version of plugin in plugin file. For example if plugin version is 1.2.1. You can make it like below (100.9.5 something that plugin author will never reach to )

<?php
/*
 * Plugin Name:       Your Plugin Name
 * Description:       Plugin description.
 * Version:           100.9.5 
*/
Patrick S
  • 490
  • 5
  • 17
  • This really is not the correct solution. This means the system still thinks you are using the other plugin, just a newer version. You should rename the plugin to something unique. – Laurence Cope Jul 25 '22 at 15:38
3

Here's an updated version of Mark Jaquith's script:

  • WP Updates have switched to HTTPS
  • Unserialize was blocked on my shared hosting
  • This uses json_decode and json_encode instead
  • Credit: Block Plugin Update

.

add_filter( 'http_request_args', 'widget_disable_update', 10, 2 );

function widget_disable_update( $r, $url ) {
    if ( 0 === strpos( $url, 'https://api.wordpress.org/plugins/update-check/' ) ) {
        $my_plugin = plugin_basename( __FILE__ );
        $plugins = json_decode( $r['body']['plugins'], true );
        unset( $plugins['plugins'][$my_plugin] );
        unset( $plugins['active'][array_search( $my_plugin, $plugins['active'] )] );
        $r['body']['plugins'] = json_encode( $plugins );
    }
    return $r;
}
skibulk
  • 3,088
  • 1
  • 34
  • 42
  • It's 2019 and the [Block Plugin Update](https://wordpress.org/plugins/block-specific-plugin-updates/) plugin is still doing fine :-) (Can only be installed manually as it seems to be too old to be found in the plugin repo search from within WordPress.) – tanius Jun 21 '19 at 21:49
1

As of WordPress v5.8, all you need to use is the Update URI field in your plugin header. Set it to anything that does not match these patterns (where {$slug} is your actual plugin's slug):

https://wordpress.org/plugins/{$slug}/
w.org/plugin/{$slug}
Walf
  • 8,535
  • 2
  • 44
  • 59
0

Disable plugin updates manually:

  1. Open functions.php file (go to your activated themes folder)
  2. Copy and paste the following code:

remove_action( 'load-update-core.php', 'wp_update_plugins' );

add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );

  1. Save changes, and you’re done
Hemant Ramphul
  • 565
  • 5
  • 8
0

Just for completeness, here is one more plugin meant to block updates of selected other plugins:

https://github.com/daggerhart/lock-plugins

Some information about its background and mode of function can be found here (in German).

tanius
  • 14,003
  • 3
  • 51
  • 63