Skip to content

Instantly share code, notes, and snippets.

@benjibee
Last active November 25, 2019 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjibee/c3c3340aaa25a39bea36d5a2fb07070e to your computer and use it in GitHub Desktop.
Save benjibee/c3c3340aaa25a39bea36d5a2fb07070e to your computer and use it in GitHub Desktop.
Default Maintenance Page for Wordpress
<?php
// place in wp-content directory to
// automatically override default page
http_response_code(503);
wp_load_translations_early();
?><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><?php _e('Maintenance'); ?></title>
</head>
<body>
<h1><?php _e('Maintenance'); ?></h1>
<p><?php _e('Briefly unavailable for scheduled maintenance. Check back in a minute.'); ?></p>
<script>
(function check_status() {
"use strict";
var xhr = new XMLHttpRequest();
xhr.open("HEAD", window.location, true);
xhr.addEventListener("load", function () {
if (xhr.status >= 200 && xhr.status < 400) {
window.location.reload();
} else {
setTimeout(check_status, 3000);
}
});
xhr.addEventListener("error", function () {
setTimeout(check_status, 3000);
});
xhr.send();
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment