Aurangajeb

Removes the Top Admin Toolbar menu for users who are not Super Admins of a multisite network

Jun 9th, 2022 (edited)
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. //Removes the Top Admin Toolbar menu for users who are not Super Admins of a multisite network
  2.  
  3. add_action( 'admin_bar_menu', 'remove_wp_customize_edit', 999 );
  4.  
  5. function remove_wp_customize_edit( $wp_admin_bar ) {
  6.  
  7. if ( !is_admin() ) {
  8.  
  9. $wp_admin_bar->remove_node( 'edit' );
  10. $wp_admin_bar->remove_menu('customize');
  11.  
  12. }
  13. }
  14.  
  15. ##################################
  16. // add a link to the WP Toolbar
  17. ##################################
  18.  
  19. function custom_toolbar_link($wp_admin_bar) {
  20.     $args = array(
  21.         'id' => 'id-management',
  22.         'title' => 'Management',
  23.         'href' => '/management',
  24.         'meta' => array(
  25.             'class' => 'management',
  26.             'title' => 'Management'
  27.             )
  28.     );
  29.     $wp_admin_bar->add_node($args);
  30. }
  31. add_action('admin_bar_menu', 'custom_toolbar_link', 999);
Add Comment
Please, Sign In to add comment