Advertisement
arie_cristianD

hide admin menu for contributor

Oct 25th, 2023
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. function hide_some_admin_menu() {
  2.     if ( current_user_can( 'contributor' ) ) {
  3.  
  4.             // Menu Footer Builder
  5.             remove_menu_page( 'edit.php?post_type=footer' );
  6.             // Menu Post Template
  7.             remove_menu_page( 'edit.php?post_type=custom-post-template' );
  8.             // Menu Archive Template
  9.             remove_menu_page( 'edit.php?post_type=archive-template' );
  10.             // Menu Custom Menu
  11.             remove_menu_page( 'edit.php?post_type=custom-mega-menu' );
  12.             // Menu Comment
  13.             remove_menu_page( 'edit-comments.php' );
  14.             // Menu Tools
  15.             remove_menu_page( 'tools.php' );
  16.             // Menu Template
  17.             remove_menu_page( 'edit.php?post_type=elementor_library' );
  18.             // Dashboard Menu
  19.             remove_menu_page( 'index.php' );
  20.  
  21.     }
  22. }
  23. add_action( 'admin_init', 'hide_some_admin_menu' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement