您需要结合一些插件和几个挂钩。
除了角色管理,我建议Adminimize: 根据用户角色清理仪表板非常强大。
然后:
/**
* When a registered user tries to visit a page for which he doesn\'t have access,
* i.e.: http:/example.com/wp-admin/plugins.php,
* WordPress displays a standard WP error message.
* This will redirect instead of displaying the message:
* "You do not have sufficient permissions to access this page."
*/
add_action( \'admin_page_access_denied\', \'access_denied_wpse_57206\' );
function access_denied_wpse_57206()
{
wp_redirect( home_url() );
exit();
}
/**
* Redirect users of an specific role, if they try to access a URL
* of an admin page that they would have capability to do
* i.e.: http:/example.com/wp-admin/tools.php
*/
add_action( \'admin_init\', \'admin_init_wpse_81841\' );
function admin_init_wpse_81841()
{
global $current_user, $pagenow;
get_currentuserinfo();
if ( \'tools.php\' == $pagenow && user_can( $current_user, \'editor\' ) )
{
wp_redirect( admin_url( \'index.php\' ) );
exit();
}
// Add as many conditions as necessary
}