How to allow WordPress updates to only one specific administrator?

Question

I found a code to prevent WordPress update for certain user role:

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

What about allowing to update for only one user?

0
, , , twelvell 4 months 0 Answers 53 views 0

Leave an answer