Remove admin menu's from Wordpress Dashboard
I've been searching for this for a while and have finally found out how to do it.
I wanted to remove the different admin menus that many wordpress roles are able to see such as 'comments', 'dashboard', 'links' and so on.
Here's some PHP you can put in your theme's functions.php file to remove them!
You can edit the $restricted array to include/exclude the different aspects of the menu. (I.E. remove '__('Comments'),' from below in order to have them be shown in the backend.
/*-------------------------------------------------------------------------------
Remove Dashboard Menu Items
-------------------------------------------------------------------------------*/
function remove_menus()
{
global $menu;
global $current_user;
get_currentuserinfo();
if($current_user->user_login == 'username')
{
$restricted = array(__('Posts'),
__('Media'),
__('Links'),
__('Pages'),
__('Comments'),
__('Appearance'),
__('Plugins'),
__('Users'),
__('Tools'),
__('Settings')
);
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
}// end while
}// end if
}
add_action('admin_menu', 'remove_menus');
All credit goes to:
http://www.elliotcondon.com/wordpres...-in-wordpress/
Advanced Power Tips for WordPress Template Developers: Reloaded - Smashing Magazine
Hope it can help someone
https://www.letscommence.com/ - better logo design briefs for designers
Need Hosting with serious speed and power? 3.99 a month. Take a look here. Serious Website Hosting.
Need Hosting with serious speed and power? 3.99 a month. Take a look here. Serious Website Hosting.
Cheers,
Kathy
Greg Schueler - Wordpress Fanatic... Living The Offline Marketing Dream...
Get information about car problems and start work at home and earn.
https://www.letscommence.com/ - better logo design briefs for designers