Hide the Astra settings for user roles

Hide the Astra settings for user roles on child sites.

Snippet Type

Execute on Child Sites

Snippet

add_action( 'do_meta_boxes', 'ast_remove_plugin_metaboxes' );

/**
* Remove Astra settings meta box for users that are not administrators
*/
function ast_remove_plugin_metaboxes(){
    if ( ! current_user_can( 'administrator' ) ) {
        remove_meta_box( 'astra_settings_meta_box', 'page', 'side' ); // Remove Astra Settings in Pages
        remove_meta_box( 'astra_settings_meta_box', 'post', 'side' ); // Remove Astra Settings in Posts
    }
}