Restrict Admin Area To Only Admin Users

WordPress Security

When you create a new user in the Wordpress user manager they will be able to login to your site by going to the default Wordpress login page /wp-login.php. Depending on the role you have assigned to this user they will see different options in the admin area.

Even if the user has the lowest level of role a Subscriber assigned to them they will be able to log into the Wordpress admin area but all they will be able to do is edit their own profile. But if your not doing anything with this profile information then there is no need for them to login to edit the profile.

If you don't want other users to be able to log in to your Wordpress admin area you can restrict access depending on a certain role.

In this example we are just going to allow admin users access to login to the admin area. We are going to use the Wordpress action admin_init which will run when you access any admin page, from here we can check the access right of the user and redirect if we need to.

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To Newsletter

Get weekly updates to your email