Last active
November 25, 2019 17:25
-
-
Save benjibee/c3c3340aaa25a39bea36d5a2fb07070e to your computer and use it in GitHub Desktop.
Default Maintenance Page for Wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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