Hide Beaver Builder Menu Links on WordPress Dashboard

I’m looking for the correct code to use to hide “Sub Menu” items of the Beaver Builder menu on the WordPress Dashboard. I’ve determined how to hide the entire Beaver Builder menu, but I’d like to hide specific submenus like “categories” or “templates,” not the entire Beaver Builder menu. Here’s the code I’m using so far:

++++++++++++++
function hide_menu(){
global $current_user;
$username = $current_user->user_login;

if ($username !== ‘MyUsername’){

remove_menu_page( ‘edit.php?post_type=fl-builder-template’ ); // This code line works
remove_submenu_page( ‘edit.php?post_fl-builder-template’, ‘edit-tags.php?taxonomy=fl-builder-template-category&post_type=fl-builder-template’ ); // This code line does not work

}
}

add_action(‘admin_head’, ‘hide_menu’);
++++++++++++++

There are a bunch of plugins that can do that. https://wordpress.org/plugins/wp-custom-admin-interface/

However your code for the submenu first parameter doesn’t match the one for the page.

Thanks for the reply. I’ve actually tested countless variations on the submenu line and can’t find what works. While I know there are plenty of plugin options out there, I’m setting up my own WordPress Dashboard Settings Customization plugin and dumping the plugin I’ve previously used for simplicity. Beaver Builder is the only plugin that has stumped me with setting this up.

1 Like

SOLUTION

++++++++++++++

function hide_menu(){
global $current_user;
$username = $current_user->user_login;

if ($username !== ‘MyUsername’){

//remove_menu_page( 'edit.php?post_type=fl-builder-template' );
remove_submenu_page( 'edit.php?post_type=fl-builder-template', 'edit.php?post_type=fl-theme-layout' ); // Themer Layouts
remove_submenu_page( 'edit.php?post_type=fl-builder-template', 'edit.php?post_type=fl-builder-template&fl-builder-template-type=layout' ); // Templates
//remove_submenu_page( 'edit.php?post_type=fl-builder-template', 'edit.php?post_type=fl-builder-template&fl-builder-template-type=row' ); // Rows
//remove_submenu_page( 'edit.php?post_type=fl-builder-template', 'edit.php?post_type=fl-builder-template&fl-builder-template-type=column' ); // Columns
//remove_submenu_page( 'edit.php?post_type=fl-builder-template', 'edit.php?post_type=fl-builder-template&fl-builder-template-type=module' ); // Modules
remove_submenu_page( 'edit.php?post_type=fl-builder-template', 'edit-tags.php?taxonomy=fl-builder-template-category&post_type=fl-builder-template' ); // Categories
remove_submenu_page( 'edit.php?post_type=fl-builder-template', 'fl-builder-add-new' ); // Add New

}
}

add_action(‘admin_head’, ‘hide_menu’);

++++++++++++++

1 Like