A WordPress plugin that makes WordPress readonly. It's main use case is blue/green deployments, in which the active application slot requires a (short) readonly window to sync the database to the other slot.
Features:
WP-CLI
commands to enable and disable the readonly mode- Notify logged-in users (in the admin) of upcoming
readonly
phase using notification. - Disable login for all users during both
prepare
andreadonly
phase. - Drop all
POST
requests duringreadonly
phase with a503 Service Unavailable
. - Refreshes admin pages for logged-in users once readonly mode is disabled.
This plugin is designed for WordPress websites that use Composer
, such as Bedrock.
composer require pivvenit/wordpress-readonly
Enable readonly mode
./vendor/bin/wp readonly enable
Disable readonly mode
./vendor/bin/wp readonly disable