{"id":29994,"date":"2014-06-11T03:01:32","date_gmt":"2014-06-11T03:01:32","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/wp-force-login\/"},"modified":"2025-02-07T16:57:49","modified_gmt":"2025-02-07T16:57:49","slug":"wp-force-login","status":"publish","type":"plugin","link":"https:\/\/ceb.wordpress.org\/plugins\/wp-force-login\/","author":13874117,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"5.6.3","stable_tag":"5.6.3","tested":"6.7.5","requires":"4.6","requires_php":"","requires_plugins":null,"header_name":"Force Login","header_author":"Kevin Vess","header_description":"","assets_banners_color":"ea2340","last_updated":"2025-02-07 16:57:49","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/www.paypal.com\/cgi-bin\/webscr?cmd=_donations&business=forcelogin%40vess%2eme&lc=US&item_name=Force%20Login%20for%20WordPress&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted","header_plugin_uri":"https:\/\/wordpress.org\/plugins\/wp-force-login\/","header_author_uri":"https:\/\/brightlightmedia.co\/","rating":4.8,"author_block_rating":0,"active_installs":30000,"downloads":9062814,"num_ratings":102,"support_threads":1,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.1":{"tag":"1.1","author":"kevinvess","date":"2014-07-17 18:24:23"},"1.2":{"tag":"1.2","author":"kevinvess","date":"2014-09-18 02:53:05"},"1.3":{"tag":"1.3","author":"kevinvess","date":"2014-10-06 20:52:35"},"2.0":{"tag":"2.0","author":"kevinvess","date":"2014-10-06 21:07:35"},"2.1":{"tag":"2.1","author":"kevinvess","date":"2014-12-23 08:45:41"},"3.0":{"tag":"3.0","author":"kevinvess","date":"2015-08-03 17:07:16"},"3.1":{"tag":"3.1","author":"kevinvess","date":"2015-08-24 21:07:11"},"3.2":{"tag":"3.2","author":"kevinvess","date":"2015-08-25 02:32:37"},"3.3":{"tag":"3.3","author":"kevinvess","date":"2016-01-28 22:39:49"},"4.0":{"tag":"4.0","author":"kevinvess","date":"2016-03-30 17:31:36"},"4.1":{"tag":"4.1","author":"kevinvess","date":"2016-05-17 19:53:35"},"4.2":{"tag":"4.2","author":"kevinvess","date":"2016-08-07 15:04:18"},"5.0":{"tag":"5.0","author":"kevinvess","date":"2016-12-14 20:17:23"},"5.1":{"tag":"5.1","author":"kevinvess","date":"2017-11-16 03:26:44"},"5.1.1":{"tag":"5.1.1","author":"kevinvess","date":"2017-12-15 20:11:51"},"5.2":{"tag":"5.2","author":"kevinvess","date":"2018-07-04 13:53:32"},"5.3":{"tag":"5.3","author":"kevinvess","date":"2019-02-25 15:50:49"},"5.4":{"tag":"5.4","author":"kevinvess","date":"2020-11-09 22:15:04"},"5.5":{"tag":"5.5","author":"kevinvess","date":"2020-11-16 19:16:14"},"5.6":{"tag":"5.6","author":"kevinvess","date":"2021-06-05 23:38:51"},"5.6.1":{"tag":"5.6.1","author":"kevinvess","date":"2021-06-06 17:26:08"},"5.6.2":{"tag":"5.6.2","author":"kevinvess","date":"2021-06-08 16:04:02"},"5.6.3":{"tag":"5.6.3","author":"kevinvess","date":"2025-02-07 16:57:49"}},"upgrade_notice":{"5.5":"<p>Deprecated whitelist filter, use v_forcelogin_bypass instead.<\/p>","5.1":"<p>Restricts access to the REST API for authorized users only.<\/p>","5.0":"<p>New feature: added bypass filter. Tweak: changed hook for Force Login to run later.<\/p>","4.1":"<p>Multisite users can only access their assigned sites, except &#039;Super Admin&#039; users.<\/p>","4.0":"<p>New feature: added exceptions for AJAX, Cron, and WP-CLI requests. Fix: Multisite users can only access their assigned sites.<\/p>","3.2":"<p>Removed function v_getUrl().<\/p>","3.0":"<p>New features: added filters for customizing the plugin.<\/p>","2.0":"<p>New feature: added redirect to send visitors back to the URL they tried to visit after logging-in.<\/p>"},"ratings":{"1":3,"2":3,"3":0,"4":0,"5":96},"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":1768800,"resolution":"128x128","location":"assets","locale":""},"icon-256x256.png":{"filename":"icon-256x256.png","revision":1768800,"resolution":"256x256","location":"assets","locale":""},"icon.svg":{"filename":"icon.svg","revision":1904031,"resolution":false,"location":"assets","locale":false}},"assets_banners":{"banner-1544x500.png":{"filename":"banner-1544x500.png","revision":1768800,"resolution":"1544x500","location":"assets","locale":""},"banner-772x250.png":{"filename":"banner-772x250.png","revision":1768800,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.1","1.2","1.3","2.0","2.1","3.0","3.1","3.2","3.3","4.0","4.1","4.2","5.0","5.1","5.1.1","5.2","5.3","5.4","5.5","5.6","5.6.1","5.6.2","5.6.3"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[396,870,1213,51114,1933],"plugin_category":[38,54,58],"plugin_contributors":[80179],"plugin_business_model":[],"class_list":["post-29994","plugin","type-plugin","status-publish","hentry","plugin_tags-privacy","plugin_tags-private","plugin_tags-protected","plugin_tags-registered-only","plugin_tags-restricted","plugin_category-authentication","plugin_category-security-and-spam-protection","plugin_category-user-management","plugin_contributors-kevinvess","plugin_committers-kevinvess"],"banners":{"banner":"https:\/\/ps.w.org\/wp-force-login\/assets\/banner-772x250.png?rev=1768800","banner_2x":"https:\/\/ps.w.org\/wp-force-login\/assets\/banner-1544x500.png?rev=1768800","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":"https:\/\/ps.w.org\/wp-force-login\/assets\/icon.svg?rev=1904031","icon":"https:\/\/ps.w.org\/wp-force-login\/assets\/icon.svg?rev=1904031","icon_2x":false,"generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Easily hide your WordPress site from public viewing by requiring visitors to log in first. As simple as flipping a switch.<\/p>\n\n<p>Make your website private until it's ready to share publicly, or keep it private for members only.<\/p>\n\n<p><strong>Features<\/strong><\/p>\n\n<ul>\n<li>WordPress Multisite compatible.<\/li>\n<li>Login redirects visitors back to the url they tried to visit.<\/li>\n<li>Extensive Developer API (hooks &amp; filters).<\/li>\n<li>Customizable. Set a specific URL to always redirect to on login.<\/li>\n<li>Filter exceptions for certain pages or posts.<\/li>\n<li>Restrict REST API to authenticated users.<\/li>\n<li>Translation Ready &amp; WPML certified.<\/li>\n<\/ul>\n\n<p><strong>Bug Reports<\/strong><\/p>\n\n<p>Bug reports for <a href=\"https:\/\/github.com\/kevinvess\/wp-force-login\">Force Login are welcomed on GitHub<\/a>. Please note that GitHub is <em>not<\/em> a support forum.<\/p>\n\n<!--section=installation-->\n<p>Upload the Force Login plugin to your site, then Activate it.<\/p>\n\n<p>1, 2: You're done!<\/p>\n\n<!--section=faq-->\n<dl>\n<dt id='1.%20how%20can%20i%20specify%20a%20redirect%20url%20on%20login%3F'><h3>1. How can I specify a redirect URL on login?<\/h3><\/dt>\n<dd><p>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 <a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/login_redirect\/\">login_redirect<\/a> to your functions.php file.<\/p><\/dd>\n<dt id='2.%20how%20can%20i%20add%20exceptions%20for%20certain%20pages%20or%20posts%3F'><h3>2. How can I add exceptions for certain pages or posts?<\/h3><\/dt>\n<dd><p>You can bypass Force Login based on any condition by adding the following filter to your functions.php file.<\/p>\n\n<p>You may use the WordPress <a href=\"https:\/\/developer.wordpress.org\/themes\/references\/list-of-conditional-tags\/\">Conditional Tags<\/a> in your code.<\/p>\n\n<pre><code>\/**\n * Bypass Force Login to allow for exceptions.\n *\n * @param bool $bypass Whether to disable Force Login. Default false.\n * @param string $visited_url The visited URL.\n * @return bool\n *\/\nfunction my_forcelogin_bypass( $bypass, $visited_url ) {\n\n  \/\/ Allow 'My Page' to be publicly accessible\n  if ( is_page('my-page') ) {\n    $bypass = true;\n  }\n\n  return $bypass;\n}\nadd_filter( 'v_forcelogin_bypass', 'my_forcelogin_bypass', 10, 2 );\n<\/code><\/pre>\n\n<p>Check out the <a href=\"https:\/\/github.com\/kevinvess\/wp-force-login\/wiki\">Force Login Wiki on GitHub<\/a> for additional examples to allow URLs to be publicly accessible.<\/p><\/dd>\n<dt id='3.%20how%20do%20i%20hide%20the%20%22%E2%86%90%20back%20to%20%7Bsitename%7D%22%20link%3F'><h3>3. How do I hide the \"\u2190 Back to {sitename}\" link?<\/h3><\/dt>\n<dd><p>The WordPress login screen includes a \"\u2190 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.<\/p>\n\n<p><strong>Requires:<\/strong> WordPress 2.5 or higher<\/p>\n\n<pre><code>\/\/ Hide the 'Back to {sitename}' link on the login screen.\nfunction my_forcelogin_hide_backtoblog() {\n  echo '&lt;style type=\"text\/css\"&gt;#backtoblog{display:none;}&lt;\/style&gt;';\n}\nadd_action( 'login_enqueue_scripts', 'my_forcelogin_hide_backtoblog' );\n<\/code><\/pre><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>5.6.3<\/h4>\n\n<ul>\n<li>Fix - Fixed issue for sites with a custom login URL.<\/li>\n<\/ul>\n\n<h4>5.6.2<\/h4>\n\n<ul>\n<li>Fix - Fixed issue for sites with a custom login URL.<\/li>\n<\/ul>\n\n<h4>5.6.1<\/h4>\n\n<ul>\n<li>Fix - Fixed too many redirects issue for Multisite users.<\/li>\n<\/ul>\n\n<h4>5.6<\/h4>\n\n<ul>\n<li>Feature - Added filter for Multisite unauthorized error message.<\/li>\n<li>Tweak - Allow logged-in Multisite users to access bypassed pages of other sites.<\/li>\n<\/ul>\n\n<h4>5.5<\/h4>\n\n<ul>\n<li>Tweak - Deprecated whitelist filter, use v_forcelogin_bypass instead.<\/li>\n<\/ul>\n\n<h4>5.4<\/h4>\n\n<ul>\n<li>Tweak - Improved the visited $url variable.<\/li>\n<li>Tweak - Changed code to comply with WordPress standards - props <a href=\"https:\/\/github.com\/kevinvess\/wp-force-login\/pull\/43\">Alex Bordei<\/a>.<\/li>\n<\/ul>\n\n<h4>5.3<\/h4>\n\n<ul>\n<li>Feature - Added nocache_headers() to prevent caching for the different browsers - props <a href=\"https:\/\/github.com\/kevinvess\/wp-force-login\/pull\/42\">Chris Harmoney<\/a>.<\/li>\n<li>Tweak - Removed $url parameter from whitelist filter.<\/li>\n<\/ul>\n\n<h4>5.2<\/h4>\n\n<ul>\n<li>Feature - Added $url parameter to bypass and whitelist filters.<\/li>\n<li>Tweak - Updated Multisite conditionals which determine user access to sites.<\/li>\n<li>Tweak - Moved 'v_forcelogin_redirect' filter to improve performance.<\/li>\n<\/ul>\n\n<h4>5.1.1<\/h4>\n\n<ul>\n<li>Fix - Improved the REST API restriction to allow alternative modes of authentication.<\/li>\n<\/ul>\n\n<h4>5.1<\/h4>\n\n<ul>\n<li>Tweak - Restrict access to the REST API for authorized users only - props <a href=\"https:\/\/github.com\/kevinvess\/wp-force-login\/pull\/34\">Andrew Duthie<\/a>.<\/li>\n<li>Tweak - Added load_plugin_textdomain() to properly prepare for localization at translate.wordpress.org.<\/li>\n<\/ul>\n\n<h4>5.0<\/h4>\n\n<ul>\n<li>Feature - Added filter to bypass Force Login redirect for allowing pages without specifying a URL.<\/li>\n<li>Tweak - Changed the hook for Force Login to run at a later stage in the WordPress tree.<\/li>\n<li>Fix - Replaced deprecated function - props <a href=\"https:\/\/github.com\/kevinvess\/wp-force-login\/issues\/26\">Just-Johnny<\/a>.<\/li>\n<\/ul>\n\n<h4>4.2<\/h4>\n\n<ul>\n<li>Tweak - Made plugin translation ready.<\/li>\n<\/ul>\n\n<h4>4.1<\/h4>\n\n<ul>\n<li>Fix - Multisite 'Super Admin' users do not need assigned sites to access the network.<\/li>\n<\/ul>\n\n<h4>4.0<\/h4>\n\n<ul>\n<li>Feature - Added exceptions for AJAX, Cron and WP-CLI requests.<\/li>\n<li>Fix - Only allow Multisite users access to their assigned sites.<\/li>\n<\/ul>\n\n<h4>3.3<\/h4>\n\n<ul>\n<li>Fix - Check for existence of explicit port number before appending port - props <a href=\"https:\/\/github.com\/kevinvess\/wp-force-login\/pull\/10\">Bj\u00f6rn Ali G\u00f6ransson<\/a>.<\/li>\n<\/ul>\n\n<h4>3.2<\/h4>\n\n<ul>\n<li>Tweak - Removed v_getUrl() function to reduce possible duplicates of global functions - props <a href=\"https:\/\/github.com\/johappel\">Joachim Happel<\/a>.<\/li>\n<\/ul>\n\n<h4>3.1<\/h4>\n\n<ul>\n<li>Fix - Rewrote v_getUrl() function to use HTTP_HOST instead of SERVER_NAME - props <a href=\"https:\/\/github.com\/kevinvess\/wp-force-login\/issues\/7\">Arlen22<\/a>.<\/li>\n<\/ul>\n\n<h4>3.0<\/h4>\n\n<ul>\n<li>Feature - Added filter for the redirect URL on login.<\/li>\n<li>Feature - Added filter to allow whitelisting of additional URLs.<\/li>\n<\/ul>\n\n<h4>2.1<\/h4>\n\n<ul>\n<li>Fix - Rewrote v_getUrl function to include the server port - props <a href=\"https:\/\/wordpress.org\/support\/topic\/infinite-loop-when-server-port-is-not-standard\/\">Nicolas<\/a>.<\/li>\n<\/ul>\n\n<h4>2.0<\/h4>\n\n<ul>\n<li>Feature - Added redirect to send visitors back to the URL they tried to visit before logging in.<\/li>\n<\/ul>\n\n<h4>1.3<\/h4>\n\n<ul>\n<li>Fix - Fixed password reset URL from being blocked - props <a href=\"https:\/\/wordpress.org\/support\/topic\/password-reset-url-is-blocked\/\">estebillan<\/a>.<\/li>\n<\/ul>\n\n<h4>1.2<\/h4>\n\n<ul>\n<li>Tweak - Streamlined code<\/li>\n<\/ul>\n\n<h4>1.1<\/h4>\n\n<ul>\n<li>Fix - Allow access to the registration and the lost password page URLs - props <a href=\"http:\/\/profiles.wordpress.org\/jabdo\">jabdo<\/a>.<\/li>\n<\/ul>","raw_excerpt":"Force Login is a simple lightweight plugin that requires visitors to log in to interact with the website.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/29994","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=29994"}],"author":[{"embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/kevinvess"}],"wp:attachment":[{"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=29994"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=29994"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=29994"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=29994"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=29994"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/ceb.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=29994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}