Created
January 12, 2018 01:04
-
-
Save westcoastdigital/3e6033b28f3ab17fbbd174edcf37064f to your computer and use it in GitHub Desktop.
Hide sections in admin based on user
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
| function wcd_hide_admin_sections() { | |
| $user = wp_get_current_user(); | |
| $access = 'admin'; // this is your username that gets access | |
| if($user && isset($user->user_login) && $access != $user->user_login) { ?> | |
| <style> | |
| li#toplevel_page_edit-post_type-acf-field-group, | |
| li#menu-appearance, | |
| li#menu-plugins, | |
| li#menu-users, | |
| li#menu-settings, | |
| li#menu-tools { display: none; } | |
| </style> | |
| <?php } | |
| } | |
| add_action( 'admin_head', 'wcd_hide_admin_sections' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment