Skip to content

How To Disable Update Notifications For Non-Administrators In WordPress

If you prefer to not allow your clients to update their own WordPress installs, you can disable update notifications for non-administrators in WordPress. Here’s a code which will allow only admin of the WordPress website to update the core of the site, not other users.

You can add this code to a client’s website to prevent them from messing with the core, and not allowing them to mess-up with the latest updates.

Just put the following code into functions.php file of your current theme:

if ( !current_user_can( 'manage_options' ) ) {
    //Disable Theme Updates
    remove_action( 'load-update-core.php', 'wp_update_themes' );
    add_filter( 'pre_site_transient_update_themes', create_function( '$a', "return null;" ) );
    wp_clear_scheduled_hook( 'wp_update_themes' );

    //Disable Plugin Updates
    remove_action( 'load-update-core.php', 'wp_update_plugins' );
    add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
    wp_clear_scheduled_hook( 'wp_update_plugins' );

    //Diasable Core Updates
    add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
    wp_clear_scheduled_hook( 'wp_version_check' );
}

Leave a Reply

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