Linux 软件免费装
Banner图

Force Login

开发者 kevinvess
更新时间 2025年2月8日 00:57
捐献地址: 去捐款
PHP版本: 4.6 及以上
WordPress版本: 6.7
版权: GPLv2 or later
版权网址: 版权信息

标签

privacy login private access password restricted hidden protected closed force user login registered only

下载

3.2 4.0 4.1 4.2 5.0 5.1 5.1.1 5.2 5.3 5.4 2.1 5.6 5.6.1 1.2 1.3 3.0 1.1 2.0 3.1 3.3 5.5 5.6.2 5.6.3

详情介绍:

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 Bug Reports Bug reports for Force Login are welcomed on GitHub. Please note that GitHub is not a support forum.

安装:

Upload the Force Login plugin to your site, then Activate it. 1, 2: You're done!

升级注意事项:

5.5 Deprecated whitelist filter, use v_forcelogin_bypass instead. 5.1 Restricts access to the REST API for authorized users only. 5.0 New feature: added bypass filter. Tweak: changed hook for Force Login to run later. 4.1 Multisite users can only access their assigned sites, except 'Super Admin' users. 4.0 New feature: added exceptions for AJAX, Cron, and WP-CLI requests. Fix: Multisite users can only access their assigned sites. 3.2 Removed function v_getUrl(). 3.0 New features: added filters for customizing the plugin. 2.0 New feature: added redirect to send visitors back to the URL they tried to visit after logging-in.

常见问题:

  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 to your functions.php file.

  1. 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 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 for additional examples to allow URLs to be publicly accessible.

  1. 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' );

更新日志:

5.6.3 5.6.2 5.6.1 5.6 5.5 5.4 5.3 5.2 5.1.1 5.1 5.0 4.2 4.1 4.0 3.3 3.2 3.1 3.0 2.1 2.0 1.3 1.2 1.1