Is it possible to hide the dashboard completely from the Non-admin users and give them access to only New post and edit posts page?
Thanks.
4 s
As far as ease of use, especially for WordPress Admins not too firm in PHP, I second brasoflo’s plugin recommendation (Adminimize).
For the sake of completeness, this is how it’d be done programmatically:
/* Remove the "Dashboard" from the admin menu for non-admin users */
function wpse52752_remove_dashboard () {
global $current_user, $menu, $submenu;
get_currentuserinfo();
if( ! in_array( 'administrator', $current_user->roles ) ) {
reset( $menu );
$page = key( $menu );
while( ( __( 'Dashboard' ) != $menu[$page][0] ) && next( $menu ) ) {
$page = key( $menu );
}
if( __( 'Dashboard' ) == $menu[$page][0] ) {
unset( $menu[$page] );
}
reset($menu);
$page = key($menu);
while ( ! $current_user->has_cap( $menu[$page][1] ) && next( $menu ) ) {
$page = key( $menu );
}
if ( preg_match( '#wp-admin/?(index.php)?$#', $_SERVER['REQUEST_URI'] ) &&
( 'index.php' != $menu[$page][2] ) ) {
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/edit.php');
}
}
}
add_action('admin_menu', 'wpse52752_remove_dashboard');