[Solved] Disable WordPress plugin update notifications (function)

  

6
Topic starter

Hi, I am building WordPress website for a client and I've made some modifications to the CSS files of one of the plugins (for GDPR);

I do not want the client to update the plugin in the near future and ruin my CSS modifications within the next update!

How can I disable the update notifications in WordPress for this particular plugin?

The best option is if you can share some code to be implemented in functions.php - so it is hidden 🙂 Not a plugin...

It is a WP plugin for General Data Protection Regulation (GDPR) Compliance.

Thanks

3 Answers
5

BTW, Insert the following code to the functions.php (better in your Child WP theme) file of your active theme. It will remove the WordPress update nag -> WordPress update is available!

/*Remove WP update notification*/
function remove_core_updates() {
    if (!current_user_can('update_core')) {
        return;
    }
    add_action('init', create_function('$a', "remove_action( 'init', 'wp_version_check' );"), 2);
    add_filter('pre_option_update_core', '__return_null');
    add_filter('pre_site_transient_update_core', '__return_null');
}
 
add_action('after_setup_theme', 'remove_core_updates');

This code below disables all the updates notifications regarding plugins, themes & WordPress completely:

/* Remove ALL WP update notifications */
function remove_core_updates() {
    global $wp_version;
    return (object) array('last_checked' => time(), 'version_checked' => $wp_version,);
}
 
add_filter('pre_site_transient_update_core', 'remove_core_updates');
add_filter('pre_site_transient_update_plugins', 'remove_core_updates');
add_filter('pre_site_transient_update_themes', 'remove_core_updates');
4

Firstly you need to use Child Theme for your WordPress theme (not required, BUT RECOMMENDED)

Secondly into the functions.php (of your child theme) add these lines of code:

/**
 * Prevent update notification for plugin: cookie-law-info
 */
function disable_plugin_updates($value) {
    if (isset($value) && is_object($value)) {
        if (isset($value->response['cookie-law-info/cookie-law-info.php'])) {
            unset($value->response['cookie-law-info/cookie-law-info.php']);
        }
    }
    return $value;
}
 
add_filter('site_transient_update_plugins', 'disable_plugin_updates');

Bear in mind that you need to add add_filter WordPress CMS function to your code.

3

You can also use this plugin Easy Updates Manager to disable:

  • Plugins
  • Themes
  • WordPress's core updates

...and then eventually hide it with the following code:

/* Hide WP plugin Easy Updates Manager in the WordPress dashboard area */
function hidePlugin() {
    echo '<style>
    .plugins-php .plugins tr[data-slug="easy-updates-manager"]{ display:none; }
</style>';
}
Share: