I want to restrict access to my WordPress site to allow registered users only. I have tried the following plugins:

  • Require-login
  • Authenticator
  • WP-lock

All of them have the same problem: After seeing the login page, you can easily retype the URL in the browser address bar to bypass the login screen and access the home page directly, without needing to login. Only the home page can be accessed in this way. Clicking on any menus, will take you back to the login screen.

I suspect there is a problem with my site, not the plugins.

I have the following active plugins:

  • Advanced Custom Fields
  • Akismet
  • Analytics360
  • Custom Post Templates
  • Custom Post Type UI
  • Disqus Comment System
  • Duplicator
  • Easy Tweet Embed
  • Email This Page
  • Google Analytics
  • Gravity Forms
  • HotSpots
  • List category posts
  • Mini twitter feed
  • Peter's Login Redirect
  • Select Q&A - WordPress Questions and Answers Plugin
  • Raw HTML
  • Relevanssi
  • Revision Control
  • Swiftype Search
  • ThreeWP Activity Monitor
  • Usernoise Pro
  • W3 Total Cache
  • WP-Lock
  • WPML Multilingual CMS

Any help would be much appreciated, thanks.

2 Answers 2


It seems to me that all you should need is this:

function force_login_wpse_89581() {
  if (!is_user_logged_in()) wp_safe_redirect(wp_login_url());

That should force users to the login page except for users who have already logged in.

I don't know what bells and whistles those plugins provide that my solution does not. Maybe you need something more complex.

  • This code does what you require, if I understand you. 1) Visitors who are not logged in are sent to the login page. 2) Visitors who are logged in can visit the site as normal.
    – s_ha_dum
    Mar 6, 2013 at 3:29

You should check out the Force Login plugin; it's lightweight, simple, and does exactly what you want to do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.