就易用性而言,特别是对于在PHP方面不太坚定的WordPress管理员,我支持Brasolo的插件建议(Adminimize).
为了完整性起见,以下是编程方式:
/* 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\');