I am currently trying to setup a redirect so that my admin users are redirected to a page other than the dashboard within the wordpress administrator interface.
If I leave out my conditional, the redirect works, but then it also redirects non-administrator users as well and I don’t want this.
Here is the code I have within functions.php
add_filter('login_redirect', 'dashboard_redirect');
function dashboard_redirect($url) {
global $current_user;
get_currentuserinfo();
$level = (int) $current_user->wp_user_level;
if ( $level > 10 ) {
$url = 'wp-admin/edit.php';
}
return $url;
}
You should not use Userlevels. Userlevels have been replaced in WP 2.0 and have been officially deprecated since 3.0
Will do what you want.
Yan also add this simple action to the ‘login_form’ (see this site for more detail).
For example, to redirect to dashboard, you can use:
If you want to redirect to another page any time they try to access the dashboard, and not just after login, use something like this:
Try wrapping the function with this current_user condition: