Skip to content
Prem Tiwari
  • WP Tutorials
  • Plugins
  • About Me
  • Featured On
  • Let’s Talk
Prem Tiwari
Home / WordPress Tutorials / Disable WordPress Updates for Specific User Roles

Disable WordPress Updates for Specific User Roles

ByPrem Tiwari Last updated onJuly 26, 2024

Disabling WordPress updates for specific user roles is crucial for maintaining control over your site’s functionality and preventing unwanted changes. To achieve this, you can use custom code snippets added to your theme’s functions.php file or a site-specific plugin.

In the example code, only administrators can see the update notifications and update a plugin for your WordPress website. However, you can also make changes in this code to add other user roles as well as per your need.

/**
 * Disable WordPress Updates for Specific User Roles.
 *
 * @return object
 */
function pt_disable_updates() {
    global $wp_version;
    return (object) array( 'last_checked' => time(), 'version_checked' => $wp_version, );
}

add_action( 'init', function () {
    if ( ! current_user_can( 'administrator' ) ) {
        // Disable WordPress core updates
        add_filter( 'pre_site_transient_update_core', 'pt_disable_updates' );
        // Disable WordPress plugin updates
        add_filter( 'pre_site_transient_update_plugins', 'pt_disable_updates' );
        // Disable WordPress theme updates
        add_filter( 'pre_site_transient_update_themes', 'pt_disable_updates' );
    }
} );

If you are not developer or You don’t want to edit your theme’s file then you can install the Disable WordPress Update Notifications and auto-update Email Notifications plugin. This plugin will completely disables the Plugins, Themes, and WordPress core update notifications displayed by WordPress based on your plugin settings.

Found it helpful? Share it with your friends on social media!

  • Facebook
  • Post on X
  • LinkedIn
Post Tags: #plugins#WordPress#WordPress admin#WordPress Security#WPSecurity
Prem Tiwari

Prem Tiwari is a passionate advocate of open source technology, with over 10+ years of experience in the WordPress domain. He has great experience when it comes to scaled WordPress projects which caters the need for big enterprise clients on WordPress and WordPress VIP-GO platform.

Facebook Twitter Instagram YouTube Linkedin

Post navigation

Previous Previous
Moderated a WordPress Security at WordCamp Bengaluru 2024
NextContinue
How to Manually Upgrade Plugins and Themes in WordPress

Collections

  • Crawling and indexing
  • Meetup
  • PHP
  • Plugins
  • SEO
  • Tech Talks
  • WooCommerce Tutorials
  • WordCamp
  • WordPress Tutorials
  • Privacy
  • Cookies
  • Disable Update Notifications
Facebook Twitter Instagram YouTube Linkedin WordPress
Scroll to top
  • WP Tutorials
  • Plugins
  • About Me
  • Featured On
  • Let’s Talk