Created
June 3, 2016 13:40
-
-
Save andrewlimaza/ab6a5d02e5b98d758f8a45db93cb7e95 to your computer and use it in GitHub Desktop.
Hide administrative menu icons for non-administrators
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
| <?php | |
| /* | |
| This will hide all default menu links inside your WP dashboard. You are able to hide custom pages by adding 'remove_menu_page(<custom_post_url>); inside the function' | |
| Copy lines 10-28 into your active theme's function.php or custom plugin. | |
| */ | |
| function remove_my_menu_pages() { | |
| if ( !current_user_can('manage_options') ) { | |
| remove_menu_page('edit.php'); // Posts | |
| remove_menu_page('upload.php'); // Media | |
| remove_menu_page('link-manager.php'); // Links | |
| remove_menu_page('edit-comments.php'); // Comments | |
| remove_menu_page('edit.php?post_type=page'); // Pages | |
| remove_menu_page('plugins.php'); // Plugins | |
| remove_menu_page('themes.php'); // Appearance | |
| remove_menu_page('users.php'); // Users | |
| remove_menu_page('tools.php'); // Tools | |
| remove_menu_page('options-general.php'); // Settings | |
| } | |
| } | |
| add_action( 'admin_init', 'remove_my_menu_pages', 10, 2 ); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment