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