I'm trying to hide the Wordpress admin menu sub menu item.
I have tried various snippets found here on StackOverflow and on Wordpress in functions.php
, but nothing is working.
This is the url to the page I want to hide: wp-admin/admin.php?page=be-websites
The reason the other code snippet which included remove_menu_page()
did not work was that it targets top level admin menu items whereas remove_submenu_page
will remove the submenu pages just as the function name suggests.
the first parameter the function takes is the slug for the parent menu and the second is the slug for the sub menu you want to remove. Source
Note: This function simply removes the menu it does not replace filtering users' permissions
function remove_admin_menu_items(){
remove_submenu_page( 'admin.php', 'be-websites' );
}
add_action('admin_menu', 'remove_admin_menu_items', 999);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.