WP Manifestindependent plugin directory
manifest / admin / site-read-only-mode

Site Read-Only Mode

Read-only mode for WordPress during migrations and deploys.

★ 0stars

Install

Download source zip No release zip yet

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/aryanjasala/site-read-only-mode/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Site Read-Only Mode

Try in WordPress Playground Latest release WordPress 6.6+ PHP 7.4+ License: GPL-2.0-or-later
PHPCS PHPStan Unit tests E2E tests Plugin Check

Read-only mode for migrations and deploys. Visitors still see the site, but nothing can be saved, so no edit, order or comment gets lost in the switch.

Freezing the site, the read-only editor, a visitor comment refused, then unfreezing


When you move a site to a new server, or replace the live database with one from staging, anything saved on the old copy during the move is lost. Maintenance mode hides the whole site. Site Read-Only Mode keeps it online and makes it read-only until you unfreeze, or until the freeze ends on its own.

[!NOTE] Free and open source under the GPL. No pro version, no upsells, no ads in wp-admin, no tracking. And it stays that way.

Features

  • wp-admin still opens, but saves, uploads, settings and plugin changes are refused
  • Block editor disables Save and Publish and says why, including for people who already have it open
  • REST and XML-RPC writes get 423 Locked. Reads still work
  • Visitors posting comments, forms, checkouts or sign-ups get a 503 with Retry-After and your own message
  • WP-Cron is held back and runs when the freeze ends
  • End time, schedule, +30 minutes and +1 hour, and quick freeze from the admin bar
  • Blocked attempts listed (who, when, what), and the last ten freezes kept
  • Logging in always works, so an admin can always unfreeze

Install

  1. Download site-read-only-mode.zip from the latest release.
  2. In WordPress, go to Plugins > Add New Plugin > Upload Plugin, choose the zip and activate it.

Or with WP-CLI:

wp plugin install https://github.com/aryanjasala/site-read-only-mode/releases/latest/download/site-read-only-mode.zip --activate

Needs WordPress 6.6+ and PHP 7.4+. To try it first, the Try in WordPress Playground badge opens a throwaway WordPress in your browser with the plugin and some demo content.

Quick look

WP-CLI is never blocked, so a deploy script can wrap the migration:

wp site-read-only-mode on --minutes=30 --reason="Moving servers"
# ... migrate ...
wp site-read-only-mode off

If the script dies halfway, the freeze still ends after 30 minutes.

Screenshots

The block editor during a freeze
The block editor during a freeze
Site Read-Only Mode during a freeze, with countdown and blocked attempts">
Tools > Site Read-Only Mode during a freeze, with countdown and blocked attempts
What visitors see when they send a form during a freeze
What visitors see when they send a form during a freeze

Documentation

Doc What it covers
Reference Constants, hooks, WP-CLI, what is blocked and what is stored
Development Local setup, commands and tests
Contributing Pull requests, required checks and PR titles
Releasing How merged pull requests become releases
Security Reporting a vulnerability
readme.txt What WordPress.org shows, with the FAQ and changelog

Project structure

site-read-only-mode.php        plugin header and PSR-4 autoloader
src/
├── Plugin.php           creates the services, guards load only while frozen
├── State.php            the saved freeze, its timing and messages
├── Freezer.php          starts, extends and ends freezes
├── BlockedLog.php       what the freeze stopped
├── History.php          the last ten freezes
├── Guards/              wp-admin, REST, front-end and cron guards
├── Admin/               freeze screen, notice, admin bar
├── Editor/EditorLock.php  locks the block editor through the heartbeat
└── Cli/Command.php      wp site-read-only-mode
assets/                  editor lock and countdown scripts
tests/
├── Unit/                PHPUnit
└── e2e/                 Playwright specs and the Docker site
.wordpress-org/          screenshots
docs/                    reference, development, contributing, releasing

More free plugins

Small plugins that each fill one gap in WordPress, all free with no pro version:

Plugin What it does
Page Template Usage See which template every page uses, and fix the pages on a missing template
Staging Guard Stops staging copies from emailing real people or getting indexed
Category & Tag Trash A trash for categories, tags and custom terms, with undo and full restore
Restore Blocks from Revisions Restore a single block from an old revision, not the whole post

License

GPL-2.0-or-later © Aryan Jasala