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.
3 Answers
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.
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
Yes, use Adminimize Plugin, remove dashboard and let the pages be the first screen when an user logs in. You can customize it very well and do a fine tuning of the entire admin backend!
UPDATE
Use the filter login_redirect
and use the admin_url
like in this Wordpress Stackechange post:
Change default admin page for specific role(s)
-
I am wary of using such a comprehensive plugin for a single purpose. Ideally I'd build this into my custom themes functions.php– TomJan 16, 2012 at 13:45