Administrator role capabilities

you’re creating a function and just initializing a local scope variable that you overwrite it.

here is a different approach:

global $wp_roles; // global class wp-includes/capabilities.php
$wp_roles->remove_cap( 'administrator', 'manage_options' );

_based on codex:remove_cap_

Edit:

/**
* Remove capability from admins.
*/
function wpcodex_set_capabilities() {

    // Get the role object.
    $admin = get_role( 'administrator' );
    $admin->remove_cap( 'manage_options' );
}
add_action( 'init', 'wpcodex_set_capabilities' );

tech