Redirect Users When Admin Bar is Hidden

In some cases, simply hiding the admin bar isn’t enough. You may want to completely restrict access to the WordPress dashboard (/wp-admin/) for users who aren’t meant to use it.

With Hide Admin Bar Pro, you can automatically redirect users away from the backend when their admin bar is hidden — ensuring they stay on the frontend or a public-facing page.


Use Cases #

  • Prevent non-admin users from accessing /wp-admin/
  • Redirect LMS students or WooCommerce customers away from backend profile pages
  • Improve UX by sending users to the homepage or custom dashboard instead of the WordPress backend

How to Enable Redirect Behavior #

1. Open Plugin Settings #

Navigate to:
Settings → Hide Admin Bar Settings

2. Locate the Setting: #

Redirect Users When Admin Bar is Hidden

This is a Pro-only checkbox.

3. Enable the Option #

Check the box to activate redirection logic.

hide-admin-bar-based-on-user-roles-admin-redirect

4. Save Changes #

Click Save Changes to apply.


What Happens When Enabled? #

If a user’s admin bar is hidden (based on any rule: role, user, time, etc.) and they try to access a backend page (/wp-admin/...), they will be automatically redirected to your site’s homepage (or another fallback URL in future versions).


Technical Notes #

  • Redirect is handled on the admin_init hook
  • AJAX requests and logged-in admins are excluded
  • Only applies to users affected by visibility rules

FAQs #

Can I change the redirect destination?
Not yet — the default is your site’s homepage. This will be customizable in a future update.

Will this block admin users?
No — only users whose admin bar is hidden will be redirected.

Can I whitelist certain backend pages?
Currently not — this is an all-or-nothing setting. More granular control is on the roadmap.

What are your feelings
Updated on April 19, 2025