Last active
September 19, 2023 02:37
-
-
Save xditx32/a29941458486004a477a36bc9a3b1aca to your computer and use it in GitHub Desktop.
Hide WordPress menus in the admin area
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Remove menus from the WordPress dashboard*/ | |
function wpdocs_remove_menus() { | |
remove_menu_page('index.php'); //Dashboard | |
remove_menu_page('edit.php'); //Posts | |
remove_menu_page('upload.php'); //Media | |
remove_menu_page('edit.php?post_type=page'); //Pages | |
remove_menu_page('edit-comments.php'); //Comments | |
remove_menu_page('themes.php'); //Appearance | |
remove_menu_page('plugins.php'); //Plugins | |
remove_menu_page('users.php'); //Users | |
remove_menu_page('tools.php'); //Tools | |
remove_menu_page('options-general.php'); //Settings | |
remove_menu_page('edit.php?post_type=project'); //Projects | |
remove_menu_page('admin.php?page=flatsome-panel'); | |
} | |
add_action('admin_menu', 'wpdocs_remove_menus'); | |
/* Hide plugin/theme/menu in the WordPress dashboard area */ | |
function wpdocs_remove_menusTwo() { | |
remove_menu_page('et_divi_options'); //Divi WP Theme | |
remove_menu_page('wpseo_dashboard'); //Yoast SEO WP Plugin | |
remove_menu_page('activity_log_page'); //Activity Log WP Plugin | |
} | |
add_action('admin_init', 'wpdocs_remove_menusTwo'); | |
/* Hide plugin/theme/menu in the WordPress dashboard area */ | |
function wpdocs_remove_menusTwo() { | |
if (get_current_user_id() == 1) { | |
remove_menu_page('activity_log_page'); //Activity Log WP Plugin | |
} | |
} | |
add_action('admin_init', 'wpdocs_remove_menusTwo'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment