To prevent my visitors from seeing a broken version of my site during maintenance, and to give them a heads up on the updates, I would like to redirect them automatically to a temporary maintenance page. I am looking for a portable solution which can be used on any site, without hardcoding URLs.
Logged in administrators (or other user level of choice) should get full access to the back-end and the front-end. There are a lot of plugins out there that offer this functionality, but I'm looking for a code-only solution.