Wordpress Snippets

Prevent WordPress From Checking Update For Plugins

Many developers were concerned about the data WordPress should send back to WordPress.org when checking update for plugins and themes. Some have expressed concern that private plugins developed for a specific client or website may contain some sensitive information in their headers, like contact information for the developer, etc and it should not be send back to WordPress.org server, for security as well as privacy reasons. So in this article I will show you how you can easily disable checking update for plugins. Previously we have posted about how to disable automatic updates for WordPress and disable their email notifications, now we will do this for plugins.

Obviously, where possible, you should always keep your plugins and WordPress versions up-to-date to avoid any security implications. However there may be times when you need stop a plugin from updating. This small WordPress code snippet will stop notifications for plugin updates.

You need to put this code in your theme’s functions.php file and it will start preventing WordPress from checking update for plugins.

// prevent wordpress from checking update for plugins
function wcs_disable_plugin_update_check( $r, $url ) {
    if ( 0 !== strpos( $url, 'http://api.wordpress.org/plugins/update-check' ) )
        return $r;

    $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', 'wcs_disable_plugin_update_check', 5, 2 );

Hire Us. Or just say Hi!
Need a job? Apply to get one.