Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress Customizing the WordPress Admin Area Controlling Admin Navigation in WordPress How to Remove and Add Admin Menu Links via the functions.php File

Remove links from admin menu for certain user

I would remove Dashboard with this code

<?php
function remove_menus(){

  if  (current_user_can('Editor') )
        remove_menu_page( 'index.php' ); //Dashboard
}
add_action( 'admin_menu', 'remove_menus' );
?>

Is it good?

Jeremy Castanza
Jeremy Castanza
12,081 Points

Hi Maxim, I haven't tested the code, but I just want to make a comment. Be sure to "namespace" your functions. i.e. remove_menus() should be maximp_remove_menus(). The reason this is good to do... Let's say I build a plugin and you install it on your WordPress site and by coincidence, I also name one of my functions "remove_menus()." You can avoid a lot of debugging by doing this. Anyways, just wanted to point this out there. Hope this helps. Cheers and happy coding!