Elegant Themes recently added a new Dashboard screen under the Divi menu, which appears by default when you click the Divi menu. This screen includes helpful links to documentation, pages, posts, templates, support, and other prompts and upsells. However, this is a change that not everyone wants, and you may prefer not to use it or have your clients access it. With our Divi Assistant plugin, we offer various features to hide upsells, including this. In this tutorial, I will show you how to hide the Divi Dashboard completely by removing the menu item using code or Divi Assistant.
▶️ Please watch the video above to get all the exciting details! 👆
Add A PHP Code Snippet To Your Site To Hide The Divi Dashboard
To hide the new Divi Dashboard menu item with code, you can use the PHP snippet below. We have instructions for where to paste PHP code if you are not familiar with it. Just remember to be careful, as PHP can cause issues if not implemented properly. After adding this snippet to your site, you can refresh the browser and the Dashboard menu item will be removed from the Divi menu in your WordPress dashboard.
Where To Paste The PHP Code
1. Divi Assistant
If you are using our Divi Assistant plugin, simply paste the code in the PHP tab in the custom code window in the Divi Visual Builder.
2. Child Theme
If you are using a child theme, paste this code into the functions.php file. If you don't have a child theme, you can generate a child theme directly on your site or download our free child theme.
3. Code Snippet Plugins
Otherwise, install a dedicated code snippet plugin, create a new snippet, and paste this code into the PHP code editor.
If you need help understanding where to paste the code, please check out our complete guide about where to add custom PHP code snippets in Divi.
// Hide Dashboard code snippet
add_action( 'init', function() {
// Restrict Page to access using direct link
global $pagenow;
$page = ! empty( $_GET['page'] ) ? $_GET['page'] : '';
if (!empty($page) && $page === 'et_onboarding' && !empty($pagenow) && $pagenow === 'admin.php') {
wp_die( esc_attr( "You don't have permission to access this page"));
}
// Enqueue CSS To Hide Divi Dashboard Option & Enqueue JS To Change Tab When Click Divi in Dashboard
add_action('admin_enqueue_scripts', function() {
// CSS
$hideDiviDashboardCSS = "#toplevel_page_et_divi_options ul.wp-submenu li a[href='admin.php?page=et_onboarding'] {display: none!important;}";
wp_register_style('pac-da-hide-divi-dashboard-option', false, [], '1.0.0');
wp_enqueue_style('pac-da-hide-divi-dashboard-option');
wp_add_inline_style('pac-da-hide-divi-dashboard-option', $hideDiviDashboardCSS);
// JS
ob_start();
?> jQuery(document).ready(function(){jQuery('a.wp-has-submenu[href="admin.php?page=et_onboarding"]').attr("href","admin.php?page=et_divi_options")}); <?php
$hideDiviDashboardJS = ob_get_contents();
ob_end_clean();
wp_register_script('pac-da-change-divi-dashboard-option', '', ['jquery'], '1.0.0', true);
wp_enqueue_script('pac-da-change-divi-dashboard-option');
wp_add_inline_script('pac-da-change-divi-dashboard-option', $hideDiviDashboardJS);
});
});
Code Explanation
This code snippet hides the Divi Dashboard menu item in WordPress. It does this by first blocking direct access to the Divi dashboard page and displaying a “You don’t have permission to access this page” message. It then uses CSS to hide the Divi Dashboard option from the admin menu and JavaScript to change the link of the Divi menu item to point to the Divi Theme Options page instead. This ensures that users cannot see or access the Divi onboarding page through the WordPress admin menu.
How To Hide The Divi Dashboard Using Divi Assistant
Here are the simple steps to hide the Divi Dashboard using our popular Divi Assistant plugin:
- Install and activate the Divi Assistant plugin
- Click on the Visual Builder Helper tab and the Upsells subtab
- Enable the setting
I hope that is easy enough for you! 😉
Awesome! Quick and easy 🙂
Thanks, so glad you liked it!
Excellent. Thank you!
You’re welcome!