Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/wy4tt34rp/ko-force-site-login/archive/refs/heads/main.zipForces all front-end visitors to log in before they can view the site.
Description
KO - Force Site Login places a login wall in front of the public-facing site.
When active, logged-out visitors are redirected to the standard WordPress login screen before they can access front-end pages. After successful login, they are returned to the exact URL they originally requested.
This plugin is intended for staging sites, private client review sites, member-only environments, and any build where the public front end should not be visible unless a user is authenticated.
What it does
- Forces login for all front-end visitors who are not already authenticated
- Redirects visitors to the native WordPress login screen
- Returns users to their originally requested page after login
- Leaves normal back-end and system processes alone
What it does NOT block
The plugin intentionally allows the following to continue working normally:
- wp-admin
- wp-login.php
- AJAX requests
- WP-Cron
- REST API requests
- WP-CLI
- Lost password, reset password, and registration actions on the login screen
Installation
- Upload the plugin folder to
/wp-content/plugins/, or upload the ZIP in the WordPress admin under Plugins > Add New. - Activate the plugin through the 'Plugins' screen in WordPress.
- Visit the front end of the site in a logged-out browser window to confirm the redirect is working.
Usage
Once activated, the plugin works automatically.
There are no settings in version 1.0.0.
If a visitor is not logged in and tries to access any front-end URL, they will be redirected to the WordPress login screen. After logging in, they will be returned to the page they originally tried to access.
Recommended use cases
- Staging sites
- Client review / approval sites
- Private development builds
- Internal portals
- Member-only or authenticated-only sites
Important notes
If your site uses a custom front-end login page, public REST endpoints, special checkout flows, or other pages that must remain accessible while logged out, this plugin may need to be extended with a whitelist.
A future version can be expanded to support:
- Custom login URL redirects
- Whitelisted pages
- Whitelisted roles
- Optional bypass rules
Changelog
1.0.0
- Initial release.
- Forces front-end visitors to log in.
- Preserves the requested URL for post-login redirect.