Wordpress- how to disable plugin update

I've found great plugin for Wordpress under GPLv2 licence 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 availible 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?

Answers


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/


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;
} 

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.


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

*/

add_filter('site_transient_update_plugins', '__return_false');

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


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;
}

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

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

define('DISALLOW_FILE_MODS',true);

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).


Need Your Help

Graphviz: change font for the whole graph?

graphviz

I am wondering if I can define an alternative font for the whole graph.

Can BufferedReader (Java) read next line without moving the pointer?

java

I am trying to read next next line without moving the pointer, is that possible?