How to Prevent a WordPress Plugin from Updating

If you purchase through a link on our site, we may earn a commission. Learn more.

I've had a couple of cases where I downloaded a plugin, then needed to make some modifications and disable updating to make sure those changes are not overwritten when the next version came out. Ever wondered how plugin updates can be disabled? Here's how to do it.
Table of Contents
WP Engine High Performance Hosting
BionicWP Hosting

I’ve had a couple of cases where I downloaded a plugin, then needed to make some modifications and disable updating to make sure those changes are not overwritten when the next version came out. Ever wondered how plugin updates can be disabled? Here’s how to do it.

Add the following code to your plugin’s core PHP 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;
}

If you enjoyed this post, make sure to subscribe to WP Mayor’s RSS feed.

Jean Galea

Jean Galea is an investor, entrepreneur, and blogger. He is the founder of WP Mayor, the plugins WP RSS Aggregator and Spotlight, as well as the Mastermind.fm podcast. His personal blog can be found at jeangalea.com.

Discover more from our archives ↓

Popular articles ↓

6 Responses

  1. Nice solution 🙂

    Another, less attractive way, is to simply increase the version number in the header of the main plugin file to something unthinkably high – like 100. That way WordPress will always think you’re using the latest version, even if you’re not.

Share Your Thoughts

Your email address will not be published. Required fields are marked *

Claim Your Free Website Tip 👇

Leave your name, email and website URL below to receive one actionable improvement tip tailored for your website within the next 24 hours.

"They identified areas for improvement that we had not previously considered." - Elliot

By providing your information, you'll also be subscribing to our weekly newsletter packed with exclusive content and insights. You can unsubscribe at any time with just one click.