Preventing a plugin from updating

First of all… It is a really bad idea to modify existing plugin.

But if you really have to do this, then you can hide update link with this code (this one works for Yoast SEO):

function remove_update_notification_link($value) {
    if ( array_key_exists('wordpress-seo/wp-seo.php', $value->response) ) {
        $value->response[ 'wordpress-seo/wp-seo.php' ]->package="";
    }
    return $value;
}
add_filter('site_transient_update_plugins', 'remove_update_notification_link');

The notice will be shown, but instead of the link to update there will be info: “Automatic update is unavailable for this plugin.”

If you put this code right in the plugin, then you can use more automatic way:

function remove_update_notification_link($value) {
    if ( array_key_exists(plugin_basename(__FILE__), $value->response) ) {
        $value->response[ plugin_basename(__FILE__) ]->package="";
    }

    return $value;
} 
add_filter('site_transient_update_plugins', 'remove_update_notification_link');

Leave a Comment