I am writing a maintenance mode plugin for my multisite setup. At its core its a very simple script that returns a maintenance mode page when a option is set. Now, I want to add cli commands to enable or disable it, but here's the catch:
When maintenance mode is enabled, any cli command just returns the html of the maintenance page.
Is there a way to circumvent this, by checking if the request came from cli or something?
In CLI it's possible to exclude plugins when executing a command, but that wont work as I need to disable the plugin which has the commands registered...
init
sounds way too early. I'd look up the order of which they are fired,template_redirect
comes to mind as it is quite late but before any of the contents are loaded/displayed.