Title: Loggedin &#8211; 限制帳號同時登入工作階段數量
Author: Joel James
Published: <strong>2016 年 7 月 1 日</strong>
Last modified: 2026 年 5 月 25 日

---

搜尋外掛

![](https://ps.w.org/loggedin/assets/banner-772x250.png?rev=3548008)

![](https://ps.w.org/loggedin/assets/icon.svg?rev=3348320)

# Loggedin – 限制帳號同時登入工作階段數量

 由 [Joel James](https://profiles.wordpress.org/joelcj91/) 開發

[下載](https://downloads.wordpress.org/plugin/loggedin.2.0.4.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/loggedin/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/loggedin/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/loggedin/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/loggedin/#developers)

 [技術支援](https://wordpress.org/support/plugin/loggedin/)

## 外掛說明

Loggedin is a lightweight WordPress plugin that lets you easily limit the number
of simultaneous active sessions a user can have. This is a crucial feature for membership
sites, online courses, and other platforms where you need to prevent users from 
sharing their accounts.

### 🎁 Features

 * **Set Global Limits**: Define a maximum number of concurrent logins for all users.
 * **Flexible Login Behavior**: Choose to either block new logins when the limit
   is reached or automatically log out the oldest session to allow a new one.
 * **Prevent Account Sharing**: By limiting sessions, you can effectively stop users
   from sharing their login credentials with others.
 * **Admin Control**: Easily force log out a user from the admin dashboard, giving
   you full control over active sessions.
 * **Developer-Friendly**: The plugin is built with a hook-based architecture, making
   it highly customizable and extensible for developers.

### 📦 Addons

Enhance LoggedIn’s functionality with these simple yet powerful [add-ons](https://duckdev.com/addons/loggedin/).

 * **[Limit Per User](https://duckdev.com/addon/limit-per-user/)**: For more granular
   control, the Limit Per User addon allows you to set specific login limits for
   individual users, overriding the global settings. This is perfect for offering
   different tiers of access or special privileges.
 * **[Limit Per Role](https://duckdev.com/addon/limit-per-role/)**: For flexible,
   group-based control, the Limit Per Role addon allows you to set specific login
   limits for individual roles, overriding the global settings. This is perfect 
   for managing access across different user groups or membership tiers.
 * **[Real-time Logout](https://duckdev.com/addon/real-time-logout/)**: This add-
   on ensures a truly seamless experience by checking for logouts in real time. 
   When a user’s session is terminated in the background due to a login limit, the
   add-on will automatically refresh their page, instantly restricting access.

### 🐛 Bug Reports

Found a bug? We welcome your bug reports! Please report any issues directly on the
[Loggedin GitHub repository](https://github.com/Joel-James/loggedin/issues).

_Please note: GitHub is for bug reports and development-related issues only. For
support, please use the WordPress.org support forums._

## 螢幕擷圖

 * [[
 * **Settings**
 * [[
 * **Manage Sessions**

## 安裝方式

 1. Install Loggedin either via the WordPress.org plugin repository or by uploading
    the files to your server. (See instructions on [how to install Loggedin](https://docs.duckdev.com/general/installing-plugin))
 2. Activate the plugin.
 3. Go to _Users > Loggedin_ to configure it.

## 常見問題集

### Where can I find the settings for Loggedin?

You can find the plugin settings by navigating to **Users > Loggedin** in your WordPress
admin dashboard.

### What are the available login logic options?

Currently, the plugin offers three built-in login logic options:

 * **Logout Oldest**: When a user reaches the login limit, their oldest active session
   will be automatically terminated to allow for the new login.
 * **Logout All**: All other active sessions for the user will be logged out when
   a new session is started.
 * **Block New**: The new login attempt will be blocked if the user has already 
   reached the maximum number of active sessions.

Additional logic options can be added using third-party plugins or custom code. 
For more details, [see our documentation here](https://docs.duckdev.com/loggedin/general-settings#login-logic).

### How long does a login session last?

The duration of a login session is determined by WordPress’s default settings.

 * If the “Remember Me” box is checked during login, the session will last for 14
   days.
 * If the “Remember Me” box is not checked, the session will last for 2 days.

You can customize this duration using the `auth_cookie_expiration` filter. Here’s
an example of how to set the session to one month:

    ```
    function custom_auth_cookie_expiration( $expire ) {
        return MONTH_IN_SECONDS; // Sets the session to one month
    }

    add_filter( 'auth_cookie_expiration', 'custom_auth_cookie_expiration' );
    ```

### What if a user has reached the login limit but doesn’t know which devices are active?

Administrators can forcefully log a user out of all their active sessions from the
dashboard.

 1. Find the user’s WordPress ID.
 2. Go to **Users > Loggedin** in your WordPress admin panel.
 3. Navigate to the **Manage Sessions** section.
 4. Enter the user ID and click the **Force Logout** button to end all of their active
    sessions.

### Can I bypass the login limit for specific users or roles?

Yes, you can bypass the limit for certain users or roles by adding a few lines of
code to your theme’s `functions.php` file or a custom plugin.

To bypass specific user IDs, use the following code:

    ```
    function loggedin_bypass_users( $bypass, $user_id ) {
        // Add the user IDs you want to bypass to this array.
        $allowed_users = array( 1, 2, 3, 4, 5 );
        return in_array( $user_id, $allowed_users );
    }

    add_filter( 'loggedin_bypass', 'loggedin_bypass_users', 10, 2 );
    ```

To bypass specific user roles, use this code:

    ```
    function loggedin_bypass_roles( $prevent, $user_id ) {
        // Add the roles you want to bypass to this array.
        $allowed_roles = array( 'administrator', 'editor' );
        $user = get_user_by( 'id', $user_id );
        $roles = ! empty( $user->roles ) ? $user->roles : array();
        return ! empty( array_intersect( $roles, $allowed_roles ) );
    }

    add_filter( 'loggedin_bypass', 'loggedin_bypass_roles', 10, 2 );
    ```

## 使用者評論

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

### 󠀁[Espectacular](https://wordpress.org/support/topic/espectacular-57/)󠁿

 [promedios](https://profiles.wordpress.org/promedios/) 2026 年 2 月 2 日

Sencillamente práctico y funcional

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

### 󠀁[A must have plugin](https://wordpress.org/support/topic/a-must-have-plugin-420/)󠁿

 [frazard99](https://profiles.wordpress.org/frazard99/) 2026 年 1 月 4 日

Keep it up!

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

### 󠀁[Love it, works like a charm](https://wordpress.org/support/topic/love-it-works-like-a-charm-2/)󠁿

 [DL](https://profiles.wordpress.org/dlinstedt/) 2025 年 9 月 26 日

Super cool plugin, lightweight, just works.

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

### 󠀁[Works perfectly for me](https://wordpress.org/support/topic/works-perfectly-for-me-37/)󠁿

 [zchas42](https://profiles.wordpress.org/zchas42/) 2025 年 8 月 4 日

Sell eLearning courses, need to prevent login sharing – combined with 2 factor authentication
this plugin does the job very nicely.

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

### 󠀁[Excellent](https://wordpress.org/support/topic/excellent-13990/)󠁿

 [emmauelbright](https://profiles.wordpress.org/emmauelbright/) 2025 年 7 月 12 
日

I like it

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

### 󠀁[Great plugin](https://wordpress.org/support/topic/great-plugin-40561/)󠁿

 [jacseq](https://profiles.wordpress.org/jacseq/) 2025 年 6 月 3 日

In use by us since at least two years. Simple and works properly.

 [ 閱讀全部 110 則使用者評論 ](https://wordpress.org/support/plugin/loggedin/reviews/)

## 參與者及開發者

以下人員參與了開源軟體〈Loggedin – 限制帳號同時登入工作階段數量〉的開發相關工作。

參與者

 *   [ Joel James ](https://profiles.wordpress.org/joelcj91/)
 *   [ Duck Dev ](https://profiles.wordpress.org/duckdev/)

〈Loggedin – 限制帳號同時登入工作階段數量〉外掛目前已有 5 個本地化語言版本。 感謝
[全部譯者](https://translate.wordpress.org/projects/wp-plugins/loggedin/contributors)
為這個外掛做出的貢獻。

[將〈Loggedin – 限制帳號同時登入工作階段數量〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/loggedin)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/loggedin/)、查看
[SVN 存放庫](https://plugins.svn.wordpress.org/loggedin/)，或透過 [RSS](https://plugins.trac.wordpress.org/log/loggedin/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/loggedin/)。

## 變更記錄

#### 2.0.4 (02/01/2026)

**👌 Improvements**

 * Review notice check.

**🐛 Bug Fixes**

 * Invalid nonce action prevents notices from being dismissed.

#### 2.0.3 (09/12/2025)

**👌 Improvements**

 * Remove debug code.

#### 2.0.2 (11/11/2025)

**🐛 Bug Fixes**

 * Nonce verification for Force Logout.
 * Uninstall cleanup.

#### 2.0.1 (11/11/2025)

**🐛 Bug Fixes**

 * Fatal errors.
 * Empty addons page.

#### 2.0.0 (10/11/2025)

**📦 New**

 * Settings page
 * Addons
 * Logout Oldest logic – Thanks [#19](https://github.com/Joel-James/loggedin/pull/19).

**👌 Improvements**

 * Coding standards.
 * Sanitization.

#### 1.3.2 (01/10/2024)

**🐛 Bug Fixes**

 * Security fixes.

#### 1.3.1 (19/09/2020)

**👌 Improvements**

 * Support ajax logins – Thanks [Carlos Faria](https://github.com/cfaria).

#### 1.3.0 (28/08/2020)

**👌 Improvements**

 * Improved “Allow” logic to check only after password check.

#### 1.2.0 (07/06/2019)

**📦 New**

 * Added ability to choose login logic.

#### 1.1.0 (06/06/2019)

**📦 New**

 * Added ability to force logout users.
 * Added cleanup on plugin uninstall.
 * Added review notice.

**👌 Improvements**

 * Code improvement

#### 1.0.1 (02/07/2016)

**🐛 Bug Fixes**

 * Fixing misspelled variable.

#### 1.0.0 (16/06/2016)

**📦 New**

 * Initial version release.

## 中繼資料

 *  版本 **2.0.4**
 *  最後更新 **2 天前**
 *  啟用安裝數 **8,000+**
 *  WordPress 版本需求 ** 5.0 或更新版本 **
 *  已測試相容的 WordPress 版本 **7.0**
 *  PHP 版本需求 ** 7.4 或更新版本 **
 *  語言
 * [Chinese (Taiwan)](https://tw.wordpress.org/plugins/loggedin/)、[English (US)](https://wordpress.org/plugins/loggedin/)、
   [German](https://de.wordpress.org/plugins/loggedin/)、[Russian](https://ru.wordpress.org/plugins/loggedin/)、
   [Spanish (Mexico)](https://es-mx.wordpress.org/plugins/loggedin/)、及 [Swedish](https://sv.wordpress.org/plugins/loggedin/).
 *  [將這個外掛本地化為你的母語版本](https://translate.wordpress.org/projects/wp-plugins/loggedin)
 * 標籤:
 * [limit](https://tw.wordpress.org/plugins/tags/limit/)[login](https://tw.wordpress.org/plugins/tags/login/)
   [logout](https://tw.wordpress.org/plugins/tags/logout/)[sessions](https://tw.wordpress.org/plugins/tags/sessions/)
   [user login](https://tw.wordpress.org/plugins/tags/user-login/)
 *  [進階檢視](https://tw.wordpress.org/plugins/loggedin/advanced/)

## 評分

 4.9 星，滿分為 5 星

 *  [  105 個 5 星使用者評論     ](https://wordpress.org/support/plugin/loggedin/reviews/?filter=5)
 *  [  2 個 4 星使用者評論     ](https://wordpress.org/support/plugin/loggedin/reviews/?filter=4)
 *  [  0 個 3 星使用者評論     ](https://wordpress.org/support/plugin/loggedin/reviews/?filter=3)
 *  [  2 個 2 星使用者評論     ](https://wordpress.org/support/plugin/loggedin/reviews/?filter=2)
 *  [  1 個 1 星使用者評論     ](https://wordpress.org/support/plugin/loggedin/reviews/?filter=1)

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

[查看全部使用者評論](https://wordpress.org/support/plugin/loggedin/reviews/)

## 參與者

 *   [ Joel James ](https://profiles.wordpress.org/joelcj91/)
 *   [ Duck Dev ](https://profiles.wordpress.org/duckdev/)

## 技術支援

最近 2 個月解決的問題:

     總計 2 個問題，已解決 1 個

 [檢視技術支援論壇](https://wordpress.org/support/plugin/loggedin/)

## 贊助

想要支援這個外掛的發展嗎？

 [ 贊助這個外掛 ](https://paypal.me/JoelCJ)