Skip to content

Instantly share code, notes, and snippets.

@benjibee

benjibee/maintenance.php

Last active Nov 25, 2019
Embed
What would you like to do?
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
You can’t perform that action at this time.