the current user may not be set at this step then try this :
if (user_can($user, 'administrator'))
{
wp_redirect($admin_url);
}
Related Posts:
- How can I restore admin capabilities?
- What determines whether admin toolbar is shown to a logged-in user?
- How do you set up a WordPress blog with multiple authors to allow something like StackExchange’s “community wiki” feature?
- WordPress Remove Submenus
- Redirect admin 403 “Cheatin uh?” admin pages
- How can I create multiple different admin roles with their own capabilities
- How do I remove dashboard access from specific user roles?
- How to Change the Default Home Page for the WordPress Dashboard?
- Prevent author from changing their posts if admin has modified
- Cannot access admin panel
- Make A WordPress Page Accessible To Admins Only, Redirect Other User Roles
- How to remove administrator role in settings -> general -> New User Default Role?
- Create un-removeable user
- Read only capability for custom post in admin area
- Custom CSS In Admin Only For Certain Roles
- Remove ability to access certain admin menus
- Remove admin AND editor from the “change role to” menu in user listing
- Role that can edit only widgets, not other theme options
- Daily notices of failed login attempts for non-existent admin user
- How to remove “Super Admin” from All Users for those that are not a “Super Admin”?
- Customize the upload screen
- Blocking Administrative Access to Authors and Subcribers?
- Customize Admin Users Screen based on Role
- Make certain pages uneditable by editors?
- Setting Login with User Name and Password default option for Jetpack Admin Login
- I keep getting logged out in Firefox
- Restrict dashboard access for specific user roles to specific actions
- Error thrown. Cannot create references to/from string offsets
- How to determine if an admin is logged in outside the loop
- Unable to login, old site with previous developer gone
- Using shared SSL for login/admin
- Logout users upon login, based on caps/role?
- wp-login behind nginx reverse-proxy inaccessible — bad redirect?
- Can’t access dashboard as administrator, login as any other level works though
- Admin cannot publish
- WordPress Admin Login Redirect Problem
- Unable to Access WP Admin or Login buttons after Migration
- using rewrites to secure login page
- Client system for media review?
- WordPress administration Over SSL – To Force SSL Logins and SSL Admin Access
- Keep Logged in Users out of Admin Panel
- Unable to get to the admin panel
- Only Admin can Edit, Delete or Update
- add_cap for editor but no admin role
- I can’t access the login panel on my offline website
- Shared account / dual blogging in WordPress
- Bind custom role to admin page
- Admin login not working
- remove menus for a specific role?
- Can’t login to my admin area
- Does deleting the table users prevent all logins?
- Locked out of WordPress website from wrong amount of login attempts
- Show global Message in User Profiles with admin only Input field in WordPress Backend
- How to make sure your admin doesn’t hi-jack you site?
- Send admin to a different login than users?
- Remove specific administrator’s capability
- Given multiple admin accounts, how can I make it so that only admin with X username can edit posts
- How should I setup the “Users” area to hand over to a client?
- solution to prevent specific admins from altering site contents
- Admin user roles/permissions
- “sufficient permissions” error for admin after duplicating WP database to new install
- Posts in sidebar only by admin
- Want to know who is login Admin/User
- How to hide plugin options for editors via functions.php
- Remove iPhone detection on login page
- Any known plugins for master admin login to edit all on front end?
- Give admin_menu permission to specific users
- Login to admin by frontend form?
- Error “Sorry, you are not allowed to access this page”
- I can’t access login page
- Cannot access wp-admin after installing SSL – user capabilities not being set
- Redirect non-admin after login, and in url – /admin
- Hide top admin panel for non admin and non editors
- Admins loggin in to our wordpress site default to the admin page
- Different role for free and pro users in wordpress without using bbpress
- WordPress login not working
- Login to Admin Dashboard Problem
- WordPress login process is hanging
- WordPress “Hide WP” Gives Me Error After Admin Login [closed]
- Scripts are not called until I login from wordpress backend
- Disable wp-admin log on lightbox overlay
- Capability to read/edit page in wp-admin only for administrators
- How to cancel redirection to admin side
- I don’t have permission to save the theme options I created myself?
- Can’t access my wp admin: captcha images invisible, gives me error message
- Different customer login form than administrator login form?
- 2FA for admin login only, is it doable?
- Add a Separator to the Admin Menu?
- Hide allow trackbacks/pingbacks
- Allow Administrator role access to custom capabilities [duplicate]
- Change admin logout URL
- Default admin color scheme as “blue”
- Can user #1 (the initial user) be deleted without ill effect?
- Remove duplicate product link from WooCommerce Page Row Actions
- Make the Status, Visibility, or Date fields opened by default in the Publish box
- Admin Top Bar Not Showing On Front End
- WordPress Hacked 5.5 admin-ajax.php [closed]
- Show private pages in public when you logged in as admin?
- Edit and delete permissions pages and posts
- Display Graphs in Admin Pages