Title: Force Login
Author: Kevin Vess
Published: <strong>11 de Xuño, 2014</strong>
Last modified: 7 de Febreiro, 2025

---

Buscar plugins

![](https://ps.w.org/wp-force-login/assets/banner-772x250.png?rev=1768800)

![](https://ps.w.org/wp-force-login/assets/icon.svg?rev=1904031)

# Force Login

 Por [Kevin Vess](https://profiles.wordpress.org/kevinvess/)

[Descargar](https://downloads.wordpress.org/plugin/wp-force-login.5.6.3.zip)

 * [Detalles](https://gl.wordpress.org/plugins/wp-force-login/#description)
 * [Valoracións](https://gl.wordpress.org/plugins/wp-force-login/#reviews)
 *  [Instalación](https://gl.wordpress.org/plugins/wp-force-login/#installation)
 * [Desenvolvemento](https://gl.wordpress.org/plugins/wp-force-login/#developers)

 [Soporte](https://wordpress.org/support/plugin/wp-force-login/)

## Descrición

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’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](https://github.com/kevinvess/wp-force-login).
Please note that GitHub is _not_ a support forum.

## Instalación

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

1, 2: You’re done!

## Preguntas frecuentes

### 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](https://developer.wordpress.org/reference/hooks/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](https://developer.wordpress.org/themes/references/list-of-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](https://github.com/kevinvess/wp-force-login/wiki)
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' );
    ```

## Comentarios

![](https://secure.gravatar.com/avatar/280ce8da2d1be2e074c491f442a66a0710068a0857d52192c948f82ebd89de82?
s=60&d=retro&r=g)

### 󠀁[Short and sweet, does what you need](https://wordpress.org/support/topic/short-and-sweet-does-what-you-need/)󠁿

 [bkjproductions](https://profiles.wordpress.org/bkjproductions/) 24 de Marzo, 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’t mind doing a little PHP you can specify certain pages can
be visible.

![](https://secure.gravatar.com/avatar/67a535c33c640eb0e3564f02f86573f854405d620c2c52f8930abc84b753c713?
s=60&d=retro&r=g)

### 󠀁[Just Works!](https://wordpress.org/support/topic/just-works-804/)󠁿

 [esyrett](https://profiles.wordpress.org/esyrett/) 4 de Marzo, 2025

I used this plugin to implement a security fence around our Members area. It’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.

![](https://secure.gravatar.com/avatar/2575687b68f004ac334b350150c3a0fe3ae1872f5b07bcb28e082ee2d0ba9f73?
s=60&d=retro&r=g)

### 󠀁[Simply works fine <3](https://wordpress.org/support/topic/simply-works-fine-3/)󠁿

 [ucsendre](https://profiles.wordpress.org/ucsendre/) 30 de Outubro, 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.

![](https://secure.gravatar.com/avatar/2c1649f010c724b55c3a04b279e0b986ea0aaae3ce2e683959e476b0f9d1cf35?
s=60&d=retro&r=g)

### 󠀁[Great but needs upkeep](https://wordpress.org/support/topic/great-but-needs-upkeep/)󠁿

 [ahmad21](https://profiles.wordpress.org/ahmad21/) 5 de Outubro, 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.

![](https://secure.gravatar.com/avatar/0c547a27a20d73b867596760646c9b69f61999cd45a9f9349164445d87f34ac3?
s=60&d=retro&r=g)

### 󠀁[Simple and helpful](https://wordpress.org/support/topic/simple-and-helpful-44/)󠁿

 [ISHIHARA](https://profiles.wordpress.org/ishihara/) 12 de Xuño, 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.

![](https://secure.gravatar.com/avatar/f427129b135d68aef8e6ae1193356900ab6835e3adf19f4ce31bac4b1d0b4ded?
s=60&d=retro&r=g)

### 󠀁[Simple & Functional](https://wordpress.org/support/topic/simple-functional-23/)󠁿

 [pmiguet](https://profiles.wordpress.org/pmiguet/) 4 de Abril, 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.

 [ Ler todas as 102 opinións ](https://wordpress.org/support/plugin/wp-force-login/reviews/)

## Colaboradores e desenvolvedores

“Force Login” é un software de código aberto. As seguintes persoas colaboraron con
este plugin.

Colaboradores

 *   [ Kevin Vess ](https://profiles.wordpress.org/kevinvess/)

“Force Login” foi traducido a 14 idiomas. Grazas [aos desenvolvedores](https://translate.wordpress.org/projects/wp-plugins/wp-force-login/contributors)
polas súas contribucións.

[Traduce “Force Login” ao teu idioma.](https://translate.wordpress.org/projects/wp-plugins/wp-force-login)

### Interesado no desenvolvemento?

[Revisa o código](https://plugins.trac.wordpress.org/browser/wp-force-login/), bota
unha ollada ao[repositorio SVN](https://plugins.svn.wordpress.org/wp-force-login/),
ou subscríbete ao [log de desenvolvemento](https://plugins.trac.wordpress.org/log/wp-force-login/)
por [RSS](https://plugins.trac.wordpress.org/log/wp-force-login/?limit=100&mode=stop_on_copy&format=rss).

## Rexistro de cambios

#### 5.6.3

 * Fix – Fixed issue for sites with a custom login URL.

#### 5.6.2

 * Fix – Fixed issue for sites with a custom login URL.

#### 5.6.1

 * Fix – Fixed too many redirects issue for Multisite users.

#### 5.6

 * Feature – Added filter for Multisite unauthorized error message.
 * Tweak – Allow logged-in Multisite users to access bypassed pages of other sites.

#### 5.5

 * Tweak – Deprecated whitelist filter, use v_forcelogin_bypass instead.

#### 5.4

 * Tweak – Improved the visited $url variable.
 * Tweak – Changed code to comply with WordPress standards – props [Alex Bordei](https://github.com/kevinvess/wp-force-login/pull/43).

#### 5.3

 * Feature – Added nocache_headers() to prevent caching for the different browsers–
   props [Chris Harmoney](https://github.com/kevinvess/wp-force-login/pull/42).
 * Tweak – Removed $url parameter from whitelist filter.

#### 5.2

 * Feature – Added $url parameter to bypass and whitelist filters.
 * Tweak – Updated Multisite conditionals which determine user access to sites.
 * Tweak – Moved ‘v_forcelogin_redirect’ filter to improve performance.

#### 5.1.1

 * Fix – Improved the REST API restriction to allow alternative modes of authentication.

#### 5.1

 * Tweak – Restrict access to the REST API for authorized users only – props [Andrew Duthie](https://github.com/kevinvess/wp-force-login/pull/34).
 * Tweak – Added load_plugin_textdomain() to properly prepare for localization at
   translate.wordpress.org.

#### 5.0

 * Feature – Added filter to bypass Force Login redirect for allowing pages without
   specifying a URL.
 * Tweak – Changed the hook for Force Login to run at a later stage in the WordPress
   tree.
 * Fix – Replaced deprecated function – props [Just-Johnny](https://github.com/kevinvess/wp-force-login/issues/26).

#### 4.2

 * Tweak – Made plugin translation ready.

#### 4.1

 * Fix – Multisite ‘Super Admin’ users do not need assigned sites to access the 
   network.

#### 4.0

 * Feature – Added exceptions for AJAX, Cron and WP-CLI requests.
 * Fix – Only allow Multisite users access to their assigned sites.

#### 3.3

 * Fix – Check for existence of explicit port number before appending port – props
   [Björn Ali Göransson](https://github.com/kevinvess/wp-force-login/pull/10).

#### 3.2

 * Tweak – Removed v_getUrl() function to reduce possible duplicates of global functions–
   props [Joachim Happel](https://github.com/johappel).

#### 3.1

 * Fix – Rewrote v_getUrl() function to use HTTP_HOST instead of SERVER_NAME – props
   [Arlen22](https://github.com/kevinvess/wp-force-login/issues/7).

#### 3.0

 * Feature – Added filter for the redirect URL on login.
 * Feature – Added filter to allow whitelisting of additional URLs.

#### 2.1

 * Fix – Rewrote v_getUrl function to include the server port – props [Nicolas](https://wordpress.org/support/topic/infinite-loop-when-server-port-is-not-standard/).

#### 2.0

 * Feature – Added redirect to send visitors back to the URL they tried to visit
   before logging in.

#### 1.3

 * Fix – Fixed password reset URL from being blocked – props [estebillan](https://wordpress.org/support/topic/password-reset-url-is-blocked/).

#### 1.2

 * Tweak – Streamlined code

#### 1.1

 * Fix – Allow access to the registration and the lost password page URLs – props
   [jabdo](https://profiles.wordpress.org/jabdo).

## Meta

 *  Versión **5.6.3**
 *  Última actualización **Fai 1 ano**
 *  Instalacións activas **30.000+**
 *  Versión de WordPress ** 4.6 ou superior **
 *  Probado ata **6.7.5**
 *  Idiomas
 * [Chinese (Taiwan)](https://tw.wordpress.org/plugins/wp-force-login/), [Czech](https://cs.wordpress.org/plugins/wp-force-login/),
   [Dutch](https://nl.wordpress.org/plugins/wp-force-login/), [English (Canada)](https://en-ca.wordpress.org/plugins/wp-force-login/),
   [English (UK)](https://en-gb.wordpress.org/plugins/wp-force-login/), [English (US)](https://wordpress.org/plugins/wp-force-login/),
   [French (France)](https://fr.wordpress.org/plugins/wp-force-login/), [German](https://de.wordpress.org/plugins/wp-force-login/),
   [Italian](https://it.wordpress.org/plugins/wp-force-login/), [Romanian](https://ro.wordpress.org/plugins/wp-force-login/),
   [Slovak](https://sk.wordpress.org/plugins/wp-force-login/), [Spanish (Chile)](https://cl.wordpress.org/plugins/wp-force-login/),
   [Spanish (Mexico)](https://es-mx.wordpress.org/plugins/wp-force-login/), [Spanish (Spain)](https://es.wordpress.org/plugins/wp-force-login/),
   e [Spanish (Venezuela)](https://ve.wordpress.org/plugins/wp-force-login/).
 *  [Traduce ao teu idioma](https://translate.wordpress.org/projects/wp-plugins/wp-force-login)
 * Etiquetas
 * [privacy](https://gl.wordpress.org/plugins/tags/privacy/)[private](https://gl.wordpress.org/plugins/tags/private/)
   [protected](https://gl.wordpress.org/plugins/tags/protected/)[registered only](https://gl.wordpress.org/plugins/tags/registered-only/)
   [restricted](https://gl.wordpress.org/plugins/tags/restricted/)
 *  [Vista avanzada](https://gl.wordpress.org/plugins/wp-force-login/advanced/)

## Valoracións

 4.8 de 5 estrelas

 *  [  95 valoracións de 5 estrelas     ](https://wordpress.org/support/plugin/wp-force-login/reviews/?filter=5)
 *  [  0 valoracións de 4 estrelas     ](https://wordpress.org/support/plugin/wp-force-login/reviews/?filter=4)
 *  [  0 valoracións de 3 estrelas     ](https://wordpress.org/support/plugin/wp-force-login/reviews/?filter=3)
 *  [  3 valoracións de 2 estrelas     ](https://wordpress.org/support/plugin/wp-force-login/reviews/?filter=2)
 *  [  3 valoracións de 1 estrelas     ](https://wordpress.org/support/plugin/wp-force-login/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/wp-force-login/reviews/#new-post)

[Ver todas as valoracións](https://wordpress.org/support/plugin/wp-force-login/reviews/)

## Colaboradores

 *   [ Kevin Vess ](https://profiles.wordpress.org/kevinvess/)

## Soporte

Problemas resoltos nos últimos dous meses:

     0 de 1

 [Ver o foro de soporte](https://wordpress.org/support/plugin/wp-force-login/)

## Doar

Queres apoiar o progreso deste plugin?

 [ Dona a este plugin ](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)