代码原理很简单,就是if elseif 判断条件
function redirect_based_on_role()
{
//get current user info
global $current_user;
get_currentuserinfo();if ($current_user->user_level == 0)
{
// User is subsriber
// Redirect to respective page
}
else if ($current_user->user_level > 1)
{
// User is contributor
// Redirect to respective page
}
else if ($current_user->user_level >8)
{
// User is editor
// Redirect to respective page
}
else
{
// No User role found
// Get out of here
}
}
// Using this action we can make this possible.
add_action(“admin_init”,”redirect_based_on_role”);

wproles

0 Comments

Leave a reply

电子邮件地址不会被公开。 必填项已用*标注

*

联系

微信ruinews360 微信公众号:小芳侠

Sending

Log in with your credentials

Forgot your details?