Tips on Customizing Toolbar Extras for Elementor & More – WordPress Admin Bar Enhanced

How to Hide Toolbar Extras Admin Menus

function plt_hide_toolbar_extras_menus() {
	//Hide "Tools → Toolbar Tools".
	remove_submenu_page('tools.php', 'http://127.0.0.1/wp-admin/options-general.php?page=toolbar-extras&tab=smart-tweaks');
	//Hide "Settings → Toolbar Extras".
	remove_submenu_page('options-general.php', 'toolbar-extras');

	//Hide "Blocks".
	remove_menu_page('edit.php?post_type=wp_block');
	//Hide "Blocks → Blocks".
	remove_submenu_page('edit.php?post_type=wp_block', 'edit.php?post_type=wp_block');
	//Hide "Blocks → Add New".
	remove_submenu_page('edit.php?post_type=wp_block', 'post-new.php?post_type=wp_block');
}

add_action('admin_menu', 'plt_hide_toolbar_extras_menus', 1000);

Where do I put this code?

How to Hide the "Toolbar Extras Overview" Dashboard Widget

function plt_hide_toolbar_extras_dashboard_widgets() {
	$screen = get_current_screen();
	if ( !$screen ) {
		return;
	}

	//Remove the "Toolbar Extras Overview" widget.
	remove_meta_box('tbex-dashboard-overview', 'dashboard', 'normal');
}

add_action('wp_dashboard_setup', 'plt_hide_toolbar_extras_dashboard_widgets', 20);