Support » Fixing WordPress » How to prevent non-admins from accessing ”/wp-admin” dashboard?

  • Is there a code I can place inside functions.php that will prevent non-admins from accessing the “/wp-admin” dashboard? Ideally, this code will prevent access and redirect non-admins to the homepage.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I don’t use the widget that has the login link. I put a “hidden” link to the admin login page in the footer. By hidden I mean the link does not change colors, is not underlined, etc. No one knows it’s a link but the one who needs to know.

    Create a links style in the style.css and then put the link in the footer.php. You may have to learn a little basic HTML and styling if you don’t know already. Just Google W3 school.

    If you keep the widget and people click on the login link they’ll go to the login page but unless they know the password that’s as far as they’ll get.

    Non admins can’t access the Dashboard without a username and password.

    Before someone logs in, it’s not possible to tell if he/she is an admin. On what condition should the redirection be done?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to prevent non-admins from accessing ”/wp-admin” dashboard?’ is closed to new replies.