Sign inDocsBlogAboutSupportContact
Security

Password protect your entire WordPress site

One command locks the frontend behind a password wall. Logged-in users bypass it automatically.

4 min read May 2026 password protect

Your staging site is live. Anyone can see it.

You're building a client site. It's on a live URL, staging.clientsite.com or a temporary domain. The design isn't done, the content is placeholder, but the URL is accessible to anyone who stumbles on it. Google might index it. A competitor might find it. The client might share the link before you're ready.

WordPress doesn't have a built-in "lock the whole site" feature. Individual posts can be password-protected, but there's no site-wide toggle.

What most people do instead

Password protection plugins Install a plugin, configure settings, pick a password. Works, but adds a plugin for a feature you'll disable in two weeks.
.htaccess password Server-level auth via .htpasswd. Requires FTP access, blocks everything including wp-admin, breaks AJAX calls.
Hope nobody finds it No robots.txt, no password, no protection. Fine until Google indexes your half-built site.

How to password protect a WordPress site without a plugin

The no-plugin route is HTTP Basic auth at the server level (Apache). You create a credentials file with htpasswd, then point an .htaccess rule at it in the WordPress root:

# 1. create the credentials file (run over SSH, outside the web root)
htpasswd -c /home/you/.htpasswd previewuser

# 2. .htaccess in the WordPress root
AuthType Basic
AuthName "Restricted"
AuthUserFile /home/you/.htpasswd
Require valid-user

Visitors now get the browser's native login box before any page loads. It works, but it is a blunt instrument:

  • It blocks everything, including wp-admin, the REST API, and admin-ajax.php, so the block editor and many AJAX features break until you add explicit <Files> exceptions.
  • You get the browser's grey auth dialog, no branded form, no styling.
  • It needs FTP/SSH access and the absolute server path to the .htpasswd file.
  • It is Apache only. On Nginx this lives in the server config, which you may not control on shared hosting.

If you want a branded wall that leaves admins and wp-admin working, the next section does it in one command.

A better way: one command, site locked

Open the navigator. Type tp password protect -password=clientpreview. Hit enter. Every frontend page now shows a password wall. Logged-in admins bypass it automatically. wp-admin, REST API, AJAX, and cron all continue working.

TrueCommander
Password protection enabled
Password Protection Active
Status Enabled
Scope All frontend pages
Bypass Logged-in users, wp-admin, REST API, AJAX, cron

Shown in advanced mode, where commands start with tp. In easy mode you type the same command without the tp prefix.

Admins never see the wall. Logged-in users, wp-admin, REST API, AJAX, cron, and login pages all bypass protection automatically. Only anonymous visitors see the password form.

How it works

1
Set a password tp password protect -password=yourpassword enables the wall. Auto-registers as a startup command so it persists across page loads.
2
Visitors see a password form A branded password page intercepts every frontend request. Correct password sets a session cookie.
3
Disable when ready Remove the startup command entry or delete it from the Startup Commands module. Site is instantly public again.
DetailValue
Command namepassword protect
Set password-password=yourpassword
ScopeAll frontend pages
BypassesLogged-in users, wp-admin, REST API, AJAX, cron, login page
Auth methodCookie-based session after correct password entry
Can be used in

Real example

You're building a WooCommerce store for a client. The site is on a temporary domain while development is in progress. The client wants to preview progress, but you don't want the public seeing an unfinished store with placeholder products and broken layouts.

You open the navigator and set a password. You send the client the URL and the password. They can browse the full site. Everyone else sees a password form. Google can't index it. Competitors can't screenshot it.

Two weeks later, the site is ready to launch. You remove the startup command entry. The password wall disappears instantly. The site is live.

Goes further with TrueCommander

Frequently asked questions

Ready?

Lock your site in one command.

This is one of 91 commands. All included with every license.

Cookies. The short version.

Essential cookies keep the cart and theme working. Analytics only fire if you say yes. Read our policy.