There could be multiple reasons for disabling updates of plugin or a theme. For example, in time constraint, you have reached for desperate measures and edited the source of a third party plugin or theme. Now, that is the practice that is bad on so many levels, but sometimes you just have to deliver in time, no matter what.
Anyway, you have done the unimaginable and edited the code of the third party plug-in or theme. And, of course, you don’t have time to make up with another solution later, and any update to that theme or plugin would overwrite your changes. It would be pretty neat if you could somehow disable updates of that part of your website.
Another situation when it would be suitable to do something like this is when you create custom plugin and/or there for the client and don’t want to send additional requests to WordPress servers.
Mark Jaquith provides an efficient piece of code to prevent this, both for plugins and themes in his post: Excluding your plugin or theme from update checks
I just added a few lines to this code which are used to check if HTTPS protocol is used.
Use this code for a theme (put in functions.php):
function my_hidden_theme_12345( $r, $url ) {
$update_url = $http_url = 'http://api.wordpress.org/themes/update-check/1.1/';
if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
$update_url = set_url_scheme( $update_url, 'https' );
if ( 0 !== strpos( $url, $update_url ) )
return $r; // Not a theme update request. Bail immediately.
$themes = unserialize( $r['body']['themes'] );
unset( $themes[ get_option( 'template' ) ] );
unset( $themes[ get_option( 'stylesheet' ) ] );
$r['body']['themes'] = serialize( $themes );
return $r;
}
add_filter( 'http_request_args', 'my_hidden_theme_12345', 5, 2 );
And this code for plugins:
function my_hidden_plugin_12345( $r, $url ) {
$update_url = $http_url = 'http://api.wordpress.org/themes/update-check/1.1/';
if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
$update_url = set_url_scheme( $update_url, 'https' );
if ( 0 !== strpos( $url, $update_url ) )
return $r; // Not a plugin update request. Bail immediately.
$plugins = unserialize( $r['body']['plugins'] );
unset( $plugins->plugins[ plugin_basename( __FILE__ ) ] );
unset( $plugins->active[ array_search( plugin_basename( __FILE__ ), $plugins->active ) ] );
$r['body']['plugins'] = serialize( $plugins );
return $r;
}
add_filter( 'http_request_args', 'my_hidden_plugin_12345', 5, 2 );