Remove dashboard, use Pages tab as default

Is there a way to have “Pages” set as the default tab when the user logs in to the admin area? I am using a heavily customised set up, where none of the dashboard widgets are useful so they are hidden anyway.

Related posts

Leave a Reply

3 comments

  1. The best way is to re-direct user logins to your page and also remove the dashboard from the menu, this can be done with 2 filters.

    Redirect logins to your page edit screen example based on user roles, this example uses “author”:

    function dashboard_redirect($url) {
        global $current_user;
        // is there a user ?
        if(is_array($current_user->roles)) {
            // check, whether user has the author role:
            if(in_array('author', $current_user->roles)) {
                 $url = admin_url('edit.php?post_type=page');
            }
            return $url;
        }
    }
    add_filter('login_redirect', 'dashboard_redirect');   
    

    Remove the “dashboard from the admin menu”

    add_action( 'admin_menu', 'Wps_remove_tools', 99 );
    function Wps_remove_tools(){
        
        remove_menu_page( 'index.php' ); //dashboard
      
       }
    

    ps. You can also order the admin menu items using the same filter.

  2. This is how you remove DASHBOARD on your WordPress fully !

    For who don’t want to use plug-in(s),
    If you installed a plug-in for remove that. You will get extra menu about that plug-in also. What the point ?
    So you should have control what you do/did


    Insert codes on functions.php

    Redirect : (When user go to url like domain.com/wp-admin)

    function dashboard_redirect(){
        wp_redirect(admin_url('edit.php?post_type=page'));
    }
    add_action('load-index.php','dashboard_redirect');
    

    Redirect after logged-in : (For prevent logging loop bugs also)

    function login_redirect( $redirect_to, $request, $user ){
        return admin_url('edit.php?post_type=page');
    }
    add_filter('login_redirect','login_redirect',10,3);
    

    Remove the Dashboard menu : (Why do you still have it?)

    function remove_menus () {
        global $menu;
        $restricted = array(__('Dashboard'));
        //$restricted = array(__('Dashboard'), __('Posts'), __('Media'), __('Links'), __('Pages'), __('Appearance'), __('Tools'), __('Users'), __('Settings'), __('Comments'), __('Plugins'));
        end($menu);
        while(prev($menu)){
            $value = explode(' ',$menu[key($menu)][0]);
            if(in_array($value[0]!= NULL?$value[0]:'',$restricted)){unset($menu[key($menu)]);}
        }
    }
    add_action('admin_menu','remove_menus');
    

    Now when user logged-in or go with url like domain.com/wp-admin/ ,..

    User will be redirected to domain.com/wp-admin/edit.php?post_type=page