Title: Force Login
Author: Kevin Vess
Published: <strong>11 Tháng 6, 2014</strong>
Last modified: 19 Tháng 6, 2026

---

Tìm kiếm plugin

![](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

 Bởi [Kevin Vess](https://profiles.wordpress.org/kevinvess/)

[Tải về](https://downloads.wordpress.org/plugin/wp-force-login.5.6.3.zip)

 * [Chi tiết](https://vi.wordpress.org/plugins/wp-force-login/#description)
 * [Đánh giá](https://vi.wordpress.org/plugins/wp-force-login/#reviews)
 *  [Cài đặt](https://vi.wordpress.org/plugins/wp-force-login/#installation)
 * [Nhà phát triển](https://vi.wordpress.org/plugins/wp-force-login/#developers)

 [Hỗ trợ](https://wordpress.org/support/plugin/wp-force-login/)

## Mô tả

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.

## Cài đặt

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

1, 2: You’re done!

## Hỏi đáp

### 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' );
    ```

## Đánh giá

![](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 Tháng 3, 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 Tháng 3, 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 Tháng 10, 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 Tháng 10, 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 Tháng 6, 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 Tháng 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.

 [ Đọc tất cả 102 đánh giá ](https://wordpress.org/support/plugin/wp-force-login/reviews/)

## Người đóng góp & Lập trình viên

“Force Login” là mã nguồn mở. Những người sau đã đóng góp vào plugin này.

Những người đóng góp

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

“Force Login” đã được dịch qua 14 ngôn ngữ. Cảm ơn [những người tham gia dịch](https://translate.wordpress.org/projects/wp-plugins/wp-force-login/contributors)
vì đóng góp của họ.

[Dịch “Force Login” sang ngôn ngữ của bạn.](https://translate.wordpress.org/projects/wp-plugins/wp-force-login)

### Muốn tham gia phát triển?

[Duyệt code](https://plugins.trac.wordpress.org/browser/wp-force-login/), check 
out [SVN repository](https://plugins.svn.wordpress.org/wp-force-login/), hoặc theo
dõi [nhật ký phát triển](https://plugins.trac.wordpress.org/log/wp-force-login/)
qua [RSS](https://plugins.trac.wordpress.org/log/wp-force-login/?limit=100&mode=stop_on_copy&format=rss).

## Nhật ký thay đổi

#### 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

 *  Phiên bản **5.6.3**
 *  Cập nhật lần cuối **1 tháng trước**
 *  Số lượt cài đặt **30.000+**
 *  Phiên bản WordPress ** 4.6 hoặc cao hơn **
 *  Đã kiểm tra lên đến **7.0.2**
 *  Ngôn ngữ
 * [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/),
   và [Spanish (Venezuela)](https://ve.wordpress.org/plugins/wp-force-login/).
 *  [Dịch sang ngôn ngữ của bạn](https://translate.wordpress.org/projects/wp-plugins/wp-force-login)
 * Thẻ
 * [privacy](https://vi.wordpress.org/plugins/tags/privacy/)[private](https://vi.wordpress.org/plugins/tags/private/)
   [protected](https://vi.wordpress.org/plugins/tags/protected/)[registered only](https://vi.wordpress.org/plugins/tags/registered-only/)
   [restricted](https://vi.wordpress.org/plugins/tags/restricted/)
 *  [Nâng cao](https://vi.wordpress.org/plugins/wp-force-login/advanced/)

## Đánh giá

 4.8 trên 5 sao.

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

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

[Xem tất cả đánh giá](https://wordpress.org/support/plugin/wp-force-login/reviews/)

## Những người đóng góp

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

## Hỗ trợ

Các lỗi đã xử lý trong vòng hai tháng gần đây:

     3 trên 3

 [Xem diễn đàn hỗ trợ](https://wordpress.org/support/plugin/wp-force-login/)

## Ủng hộ

Bạn có muốn hỗ trợ vào sự phát triển của plugin này?

 [ Ủng hộ plugin này ](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)