How to Block Dashboard Access for Non-Admins WordPress

How to Block Dashboard Access for Non-Admins WordPress
92 Views

Removing the Admin Bar for Non-Admins

Removing the admin bar is a simple code snippet. I’ve shown before how you can hide the admin bar conditionally for users. In there I’ve not mentioned how you can hide it for everyone but admins, so thats where this code snippet comes in. You need to add the code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin.

Block Dashboard Access for Non-Admins

The best way to handle someone trying to access the dashboard is to redirect them to another page. You can consider redirecting them back to the primary landing page of your site, their front-end profile (if there’s any) or just redirect them back to the page they came from.

Was this article helpful?
YesNo

Leave a comment

Your email address will not be published.