Skip to content

Instantly share code, notes, and snippets.

@remcotolsma
Last active April 7, 2016 09:15
Show Gist options
  • Save remcotolsma/be6b68ac0e7c360d8ef44362519ce26d to your computer and use it in GitHub Desktop.
Save remcotolsma/be6b68ac0e7c360d8ef44362519ce26d to your computer and use it in GitHub Desktop.
WordPress readonly from wp-config.php
<?php
// ...
if ( is_readable( 'readonly.html' ) && ! in_array( $_SERVER['REQUEST_METHOD'], array( 'HEAD', 'GET' ) ) ) {
header( 'HTTP/1.1 503 Service Temporarily Unavailable', true, 503 );
header( 'Status: 503 Service Temporarily Unavailable', true, 503 );
header( 'Retry-After: 3600' );
include 'readonly.html';
exit;
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment