Force Login

Àpèjúwe

Easily hide your WordPress site from public viewing by requiring visitors to log in first. As simple as flipping a switch.

Make your website private until itÌtumọ̀ Yorùbá: ’s ready to share publicly, or keep it private for members only.

Features

  • WordPress Multisite compatible.
  • Login redirects visitors back to the url they tried to visit.
  • Extensive Developer API (hooks & filters).
  • Customizable. Set a specific URL to always redirect to on login.
  • Filter exceptions for certain pages or posts.
  • Restrict REST API to authenticated users.
  • Translation Ready & WPML certified.

Bug Reports

Bug reports for Force Login are welcomed on GitHub. Please note that GitHub is not a support forum.

Ìgbéwọlẹ̀

Upload the Force Login plugin to your site, then Activate it.

1, 2: YouÌtumọ̀ Yorùbá: ’re done!

FAQ

1. How can I specify a redirect URL on login?

By default, the plugin sends visitors back to the URL they tried to access. However, you can redirect users to a specific URL by adding the built-in WordPress filter login_redirect to your functions.php file.

2. How can I add exceptions for certain pages or posts?

You can bypass Force Login based on any condition by adding the following filter to your functions.php file.

You may use the WordPress Conditional Tags in your code.

/**
 * Bypass Force Login to allow for exceptions.
 *
 * @param bool $bypass Whether to disable Force Login. Default false.
 * @param string $visited_url The visited URL.
 * @return bool
 */
function my_forcelogin_bypass( $bypass, $visited_url ) {

  // Allow 'My Page' to be publicly accessible
  if ( is_page('my-page') ) {
    $bypass = true;
  }

  return $bypass;
}
add_filter( 'v_forcelogin_bypass', 'my_forcelogin_bypass', 10, 2 );

Check out the Force Login Wiki on GitHub for additional examples to allow URLs to be publicly accessible.

3. How do I hide the “ Back to {sitename}” link?

The WordPress login screen includes a “ Back to {sitename}” link below the login form; which may not actually take you back to the site while Force Login is activated. You can hide this link by adding the following action to your functions.php file.

Requires: WordPress 2.5 or higher

// Hide the 'Back to {sitename}' link on the login screen.
function my_forcelogin_hide_backtoblog() {
  echo '<style type="text/css">#backtoblog{display:none;}</style>';
}
add_action( 'login_enqueue_scripts', 'my_forcelogin_hide_backtoblog' );

Àwọn àgbéyẹ̀wò

Ẹrẹ́nà 24, 2025
It is nice to find such an easy-to-use plugin, that also has a way alter with some hooks, so if you donÌtumọ̀ Yorùbá: ’t mind doing a little PHP you can specify certain pages can be visible.
Ẹrẹ́nà 4, 2025
I used this plugin to implement a security fence around our Members area. ItÌtumọ̀ Yorùbá: ’s easy. You have to have permalinks set up to include postname and then in the filter code just filter on the pages that you need to be protected.
Ọ̀wàrà 30, 2024
This plugin does what it is expected to do. No fancy extras, no bloat. Simply works. I love it. Many thanks for the author.
Ọ̀wàrà 5, 2024
Love this plugin and has helped me hide websites until they are ready for public viewing. But it needs regular more frequent updates! Compatibility/testing with the latest WordPress versions is important for site security etc.
Òkúdù 12, 2024
I find your plugin Force Login very useful and I love using it. Thank you very much. This plugin helps me to easily start a private site that only I can see or a closed site managed by a few members. I also love the fact that I can organize my members by simply managing WordPress users.
Igbe 4, 2024
Simple plugin, no fuss, works as promised. Such a simple function that could easily be implemented but here we are, using a brilliant plugin. Thanks.
Ka gbogbo àwọn àgbéyẹ̀wò 102

Àwọn Olùkópa & Olùgbéejáde

“Force Login” jẹ́ ètò ìṣàmúlò orísun ṣíṣí sílẹ̀. Àwọn ènìyàn wọ̀nyí ti ṣe ìkópa sí plugin yìí.

Àwọn Olùkópa

A ti túmọ̀ “Force Login” sí àwọn èdè agbègbè 14. Ọpẹ́lọpẹ́ fún àwọn atúmọ̀ èdè fún àwọn ìkópa wọn.

Túmọ̀ “Force Login” sí èdè rẹ.

Ṣe o nífẹ̀ẹ́ sí ìdàgbàsókè?

Ṣàwárí koodu, ṣàyẹ̀wò ibi ìpamọ́ SVN, tàbí ṣe àgbékalẹ̀ sí àkọsílẹ̀ ìdàgbàsókè nípasẹ̀ RSS.

Àkọsílẹ̀ àwọn àyípadà

5.6.3

  • Fix Ìtumọ̀ Yorùbá: – Fixed issue for sites with a custom login URL.

5.6.2

  • Fix Ìtumọ̀ Yorùbá: – Fixed issue for sites with a custom login URL.

5.6.1

  • Fix Ìtumọ̀ Yorùbá: – Fixed too many redirects issue for Multisite users.

5.6

  • Feature Ìtumọ̀ Yorùbá: – Added filter for Multisite unauthorized error message.
  • Tweak Ìtumọ̀ Yorùbá: – Allow logged-in Multisite users to access bypassed pages of other sites.

5.5

  • Tweak Ìtumọ̀ Yorùbá: – Deprecated whitelist filter, use v_forcelogin_bypass instead.

5.4

  • Tweak Ìtumọ̀ Yorùbá: – Improved the visited $url variable.
  • Tweak Ìtumọ̀ Yorùbá: – Changed code to comply with WordPress standards Ìtumọ̀ Yorùbá: – props Alex Bordei.

5.3

  • Feature Ìtumọ̀ Yorùbá: – Added nocache_headers() to prevent caching for the different browsers Ìtumọ̀ Yorùbá: – props Chris Harmoney.
  • Tweak Ìtumọ̀ Yorùbá: – Removed $url parameter from whitelist filter.

5.2

  • Feature Ìtumọ̀ Yorùbá: – Added $url parameter to bypass and whitelist filters.
  • Tweak Ìtumọ̀ Yorùbá: – Updated Multisite conditionals which determine user access to sites.
  • Tweak Ìtumọ̀ Yorùbá: – Moved ‘v_forcelogin_redirect’ filter to improve performance.

5.1.1

  • Fix Ìtumọ̀ Yorùbá: – Improved the REST API restriction to allow alternative modes of authentication.

5.1

  • Tweak Ìtumọ̀ Yorùbá: – Restrict access to the REST API for authorized users only Ìtumọ̀ Yorùbá: – props Andrew Duthie.
  • Tweak Ìtumọ̀ Yorùbá: – Added load_plugin_textdomain() to properly prepare for localization at translate.wordpress.org.

5.0

  • Feature Ìtumọ̀ Yorùbá: – Added filter to bypass Force Login redirect for allowing pages without specifying a URL.
  • Tweak Ìtumọ̀ Yorùbá: – Changed the hook for Force Login to run at a later stage in the WordPress tree.
  • Fix Ìtumọ̀ Yorùbá: – Replaced deprecated function Ìtumọ̀ Yorùbá: – props Just-Johnny.

4.2

  • Tweak Ìtumọ̀ Yorùbá: – Made plugin translation ready.

4.1

  • Fix Ìtumọ̀ Yorùbá: – Multisite ‘Super Admin’ users do not need assigned sites to access the network.

4.0

  • Feature Ìtumọ̀ Yorùbá: – Added exceptions for AJAX, Cron and WP-CLI requests.
  • Fix Ìtumọ̀ Yorùbá: – Only allow Multisite users access to their assigned sites.

3.3

  • Fix Ìtumọ̀ Yorùbá: – Check for existence of explicit port number before appending port Ìtumọ̀ Yorùbá: – props Björn Ali Göransson.

3.2

  • Tweak Ìtumọ̀ Yorùbá: – Removed v_getUrl() function to reduce possible duplicates of global functions Ìtumọ̀ Yorùbá: – props Joachim Happel.

3.1

  • Fix Ìtumọ̀ Yorùbá: – Rewrote v_getUrl() function to use HTTP_HOST instead of SERVER_NAME Ìtumọ̀ Yorùbá: – props Arlen22.

3.0

  • Feature Ìtumọ̀ Yorùbá: – Added filter for the redirect URL on login.
  • Feature Ìtumọ̀ Yorùbá: – Added filter to allow whitelisting of additional URLs.

2.1

  • Fix Ìtumọ̀ Yorùbá: – Rewrote v_getUrl function to include the server port Ìtumọ̀ Yorùbá: – props Nicolas.

2.0

  • Feature Ìtumọ̀ Yorùbá: – Added redirect to send visitors back to the URL they tried to visit before logging in.

1.3

  • Fix Ìtumọ̀ Yorùbá: – Fixed password reset URL from being blocked Ìtumọ̀ Yorùbá: – props estebillan.

1.2

  • Tweak Ìtumọ̀ Yorùbá: – Streamlined code

1.1

  • Fix Ìtumọ̀ Yorùbá: – Allow access to the registration and the lost password page URLs Ìtumọ̀ Yorùbá: – props jabdo.