WordPress.org

Ready to get started?Download WordPress

Forums

How to prevent non-admins from accessing ”/wp-admin” dashboard? (3 posts)

  1. pantone
    Member
    Posted 1 year ago #

    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.

  2. DavidAP
    Member
    Posted 1 year ago #

    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.

  3. fonglh
    Member
    Posted 1 year ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic