Posted By

rliverman on 12/19/11


Tagged

menu wordpress functions dashboard admin users roles


Versions (?)

Remove or Hide Admin Menu Links for Certain or Specific Users or Roles


 / Published in: PHP
 

In this example I used the "Members" plugin to add a capability called "hide_jobs" and that was the trigger to hide certain admin menus and also hide the "Right Now" dashboard widget.

  1. if (current_user_can('hide_jobs')) {
  2. add_action( 'admin_menu', 'my_remove_menu_jobs' );
  3. function my_remove_menu_jobs() {
  4. remove_menu_page('edit.php?post_type=job');
  5. remove_menu_page('edit.php?post_type=solution');
  6. remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); // right now
  7. }
  8. }

Report this snippet  

You need to login to post a comment.