Browse: Home / Snippets /

ProPanel: Remove widgets from admin dashboard screen

Contents


Snippet #

Important: All snippets are provided as-is without support or guarantees. These snippets are provided as guidelines for advanced users looking to customize LearnDash. For any additional help or support with these snippets, we recommend reaching out to a LearnDash Expert.

add_action( 'wp_dashboard_setup', function() {
	global $wp_meta_boxes;

	if ( ( isset( $wp_meta_boxes['dashboard'] ) ) && ( ! empty( $wp_meta_boxes['dashboard'] ) ) ) {
		foreach ( $wp_meta_boxes['dashboard'] as $priority_key => $priority_set ) {
			if ( ! empty( $priority_set ) ) {
				foreach ( $priority_set as $location_key => $location_set ) {
					if ( ! empty( $location_set ) ) {
						foreach ( $location_set as $widget_key => $widget ) {
							if ( substr( $widget_key, 0, strlen( 'learndash-propanel-' ) ) === 'learndash-propanel-' ) {
								unset( $wp_meta_boxes['dashboard'][ $priority_key ][ $location_key ][ $widget_key ] );
							}
						}
					}
				}
			}
		}
	}
}, 100 );