roles) && in_array( $role, $user->roles) ) { if ( current_user_can( $role ) && is_array( $disabled_dashboard_option_[$role] ) ) { foreach( $disabled_dashboard_option_[$role] as $widget ) { if ( isset( $widgets[$widget]['context']) ) remove_meta_box( $widget, 'dashboard', $widgets[$widget]['context'] ); } } } } } function _mw_adminimize_get_dashboard_widgets () { global $wp_meta_boxes; $widgets = array(); if ( isset($wp_meta_boxes['dashboard']) ) { foreach( $wp_meta_boxes['dashboard'] as $context => $data ) { foreach( $data as $priority => $data ) { foreach( $data as $widget => $data ) { $widgets[$widget] = array( 'id' => $widget, 'title' => strip_tags( preg_replace( '/( |)/im', '', $data['title'] ) ), 'context' => $context, 'priority' => $priority ); } } } } return $widgets; }