Open nisbet-hubbard opened 1 week ago
Just to clarify, when you say retry-after: 600
is hardcoded, are you referring to the following line?
That value is also hardcoded in WordPress core itself in wp_is_maintenance_mode()
Thanks for this info! So maybe we can just do something like the following?
function maintenance() {
if (!current_user_can('edit_themes') || !is_user_logged_in()) {
require_once ABSPATH . WPINC . '/functions.php';
wp_load_translations_early();
header( 'Retry-After: $var' );
wp_die(
__( 'Briefly unavailable for scheduled maintenance. Check back in a minute.' ),
__( 'Maintenance' ),
503
);
}
}
add_action('get_header', 'maintenance');
Feature Request
Describe your use case and the problem you are facing
When you consider that there isn’t a GUI equivalent for it,
maintenance-mode
is really one of the unique features of CLI, unfortunately not as widely known as it should be.Currently, we still have to rely on our maintenance mode snippet in
functions.php
, however, because theretry-after: 600
of CLI is hardcoded.Describe the solution you'd like
Sysadmins usually know how long the maintenance work is going to take. So ideally we’d want to be able to tell crawlers precisely how long to wait before visiting again.
A
retry-after
flag would be very much appreciated.