• Hi, , Is there any way to restrict or remove wp admin dashboard for normal users? Because wp admin dashboard shares lots of stats like jetpack, posts, visitor stats etc

Viewing 2 replies - 1 through 2 (of 2 total)
  • the dashboard for regular users doesn’t contain the same information as the admin. It very limited. You can add the following code to functions.php file. if the user is a subscriber it will redirect them to the front page and hide the menu bar.

    // this will hide the menu bar from subscribers
    function noSubscribeMenuBar(){
    $currentUser = wp_get_current_user();
    if(count($currentUser->roles) == 1 && $currentUser->roles[0] =='subscriber'){
       show_admin_bar(false);
    
    }
    
    add_action('wp_loaded','noSubscribeMenuBar');
    
    // this will redirect all subscribers to a given page
    
    function redirectSubscribers(){
    
    $currentUser = wp_get_current_user();
    if(count($currentUser->roles) == 1 && $currentUser->roles[0] =='subscriber'){
      wp_redirect(site_url('/')); 
    
    }
    
    }
    add_action('admin_init','redirectSubscribers');

    I just typed this in so hopefully there no typos.

    • This reply was modified 5 years, 2 months ago by mrtom414.
    • This reply was modified 5 years, 2 months ago by mrtom414.
    • This reply was modified 5 years, 2 months ago by mrtom414.

    There is probably a plugin that does this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Dashboard’ is closed to new replies.