前言介紹
- 這款 WordPress 外掛「Redirect to login if not logged in」是 2013-06-08 上架。
- 目前有 300 個安裝啟用數。
- 上一次更新是 2018-09-13,距離現在已有 2430 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 3.0.1 以上版本才可以安裝。
- 有 10 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
內容簡介
若使用者未登入,此外掛會將其重新導向至登入頁面,而在登入後,使用者會被重新導向到原始進入頁面。此外,此外掛也提供能夠覆寫重新導向的篩選器,以供進階使用者使用。
此外掛的原則是將所有使用者 - 從每一篇文章、頁面、檔案等等 - 重新導向至登入頁面(通常是 wp-login.php)。除了覆寫篩選器外,此外掛不會進行其他任何操作。
覆寫重新導向
注意:這個外掛不一定適合您,會員外掛可能更適合。Chris Lema 在這裡寫了關於 +30 會員外掛的優秀評論:http://chrislema.com/category/memberships-plugins/
如果您需要此外掛,而且想要在特定條件下排除特定視圖,則可以使用篩選器覆寫重新導向。
要覆寫重新導向,篩選器必須返回布林值 true。WordPress 核心提供了許多條件標籤,它們會傳回 true 或 false,或者您可以自己撰寫條件。
參考 The WordPress Codex 上的「條件標籤」頁面以獲取一些靈感。
https://codex.wordpress.org/Conditional_Tags
用法:
將範例複製/貼上/編輯到您的主題的 functions.php,或在 wp-content/mu-plugins/ 中創建一個新文件,以免編輯您的主題。
注意:請勿同時使用多個篩選器,因為這可能會產生意外的結果。相反地,請在一個篩選器中使用多個條件。
如果首頁是文章或頁面,則覆寫該部分:
add_filter( 'rtl_override_redirect', 'is_front_page' );
如果文章是「hello-world」,則會覆寫:
add_filter( 'rtl_override_redirect', function() {
return is_single( 'hello-world' );
});
如果頁面是「sample-page」,則會覆寫:
add_filter( 'rtl_override_redirect', function() {
return is_page( 'sample-page' );
});
如果頁面 ID 是 42,slug 是「sample-page」或標題是「About Me」,則會覆寫:
add_filter( 'rtl_override_redirect', function() {
return is_page( array( 42, 'sample-page', 'About Me' ) );
});
如果頁面 ID 是 42 或文章是「hello-world」,則會覆寫:
add_filter( 'rtl_override_redirect', function() {
if ( is_page( 42 ) || is_single( 'hello-world' ) ) {
return true;
}
});
原文外掛簡介
Redirects users to the login page if the user is not logged in. After login the user gets redirected to the original entry page. For advanced users a filter is provided to override the redirect.
The principle behind this plugin is to redirect all users – from every post, page, archive, etc. – to the login page (usually wp-login.php). Except for the override filter it does nothing else.
Overriding the redirect
Note: This plugin may not be for you, a membership plugin might be a better fit. Chris Lema writes excellent reviews of +30 membership plugins here: http://chrislema.com/category/memberships-plugins/
If you do have a need for this plugin and you want to exclude specific views under specific conditions, a filter is provided to override the redirect.
To override the redirect the filter must return a boolean value of true. WordPress core provides many conditional tags that either return true or false or you can write your own conditionals.
Take a look at the Conditional Tags page on The WordPress Codex for some inspiration.
https://codex.wordpress.org/Conditional_Tags
Usage:
Copy/paste/edit an example to the functions.php of your theme or create a new file in wp-content/mu-plugins/ if you do not wish to edit your theme.
Note: Be carefull not to use multiple filters at the same time as that may cause unexpected results. Instead use multiple conditions in one filter.
Override if the front page is either posts or a page:
add_filter( ‘rtl_override_redirect’, ‘is_front_page’ );
Override if the post is ‘hello-world’:
add_filter( ‘rtl_override_redirect’, function() {
return is_single( ‘hello-world’ );
});
Override if the page is ‘sample-page’:
add_filter( ‘rtl_override_redirect’, function() {
return is_page( ‘sample-page’ );
});
Override if the page ID is 42, the slug is ‘sample-page’ or the title is ‘About Me’:
add_filter( ‘rtl_override_redirect’, function() {
return is_page( array( 42, ‘sample-page’, ‘About Me’ ) );
});
Override if the page ID is 42 or a post is ‘hello-world’:
add_filter( ‘rtl_override_redirect’, function() {
if ( is_page( 42 ) || is_single( ‘hello-world’ ) ) {
return true;
}
});
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Redirect to login if not logged in」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.2 | 1.3 | 1.4 | 1.5 | 1.6.2 | 1.6.3 | 1.7.0 | trunk |
延伸相關外掛(你可能也想知道)
WPS Hide Login 》中文, WPS Hide Login 是一個非常輕量的外掛,讓您輕鬆且安全地更改登入表單頁面的網址。它不會真正地重命名或更改核心檔案,也不會添加重寫規則。它只是攔截...。
Security Optimizer – The All-In-One Protection Plugin 》透過精心挑選且易於配置的功能,SiteGround Security 外掛提供了您所需的一切來保護您的網站並預防多種威脅,例如暴力破解攻擊、登錄錯誤、資料外洩等等。, ...。
Loginizer 》Loginizer 是一個 WordPress 外掛,可幫助您對抗暴力攻擊,當 IP 地址達到最大重試次數時,該外掛會阻止其登錄。您可以使用 Loginizer 將 IP 地址列入黑名單...。Limit Login Attempts 》此外掛可限制正常登入及使用驗證 cookies 登入的次數。, WordPress 預設允許使用者無限次數嘗試登入,無論是透過登入頁面或是傳送特殊 cookies 皆可。這讓密...。
LoginPress | wp-login Custom Login Page Customizer 》LoginPress 外掛提供了很多自訂欄位,可以更改 WordPress 登入頁面的版面配置。您可以完全修改登入頁面的外觀和感覺,即使是登入錯誤訊息、忘記密碼錯誤訊息...。
WP Ghost (Hide My WP Ghost) – Security & Firewall 》Hide My WP Ghost 是一個 WordPress 安全外掛,透過強大且易於使用的功能,提供最佳的安全解決方案。它可以在不改變任何目錄或檔案的情況下,將網站的安全性...。
WPS Limit Login 》繁體中文, 限制通過登錄頁面和使用權限Cookie可能的登錄嘗試次數。, WordPress 默認情況下允許通過登錄頁面或發送特殊 Cookie 的方式進行無限制的登錄嘗試。...。
Login Lockdown & Protection 》Login LockDown 記錄每次失敗的登入嘗試的 IP 位址和時間戳記。如果在短時間內來自相同 IP 範圍的嘗試次數超過一定數量,那麼該 IP 位址的所有登入請求都會被...。
Custom Login Page Customizer 》Custom Login Page Customizer 外掛可讓您輕鬆地從 WordPress Customizer 自訂您的登入頁面!在儲存之前,您可以預覽自訂的登入頁面變更!太棒了,對吧?, , ...。
All In One Login — WordPress Login Security Plugin to Protect and Customize WP Admin 》Change wp-admin login 是一個輕量級的外掛程式,可讓您輕鬆且安全地更改 wp-admin,讓它變成您想要的東西。它不會重新命名或更改核心檔案,只是攔截頁面請求...。
WP fail2ban – Advanced Security 》Fail2ban是您可以實施來保護 WordPress 網站的最簡單和最有效的安全措施之一。, WP fail2ban 提供 WordPress 與 fail2ban 之間的連接:, Oct 17 20:59:54 foo...。
Theme My Login 》曾經希望您的 WordPress 登入頁面與網站的其餘部分相匹配嗎?現在您的願望成真了!「Theme My Login」讓您可以繞過預設的 WordPress 標誌登入頁面,該頁面與...。
Login No Captcha reCAPTCHA 》此外掛新增了 Google 無人類驗證功能的勾選框,可應用於您的 WordPress 和 Woocommerce 登錄、忘記密碼及使用者註冊頁面,讓人類使用者輕鬆透過勾選框登入,...。
WP-Members Membership Plugin 》8211; allows you to restrict file downloads to registered users only, with customizable download links., MailChimp Integration – integrates W...。
WP Hide & Security Enhancer 》WP-Hide 推出了最簡單的方法,完全隱藏 WordPress 核心文件、登錄頁面、佈景主題和外掛程式的路徑,使其不會顯示在前端,這是 Site Security 的一個巨大改進...。
