admin管理员组文章数量:1420310
I used this code for several years now:
add_action('wp_loaded', 'check_maintenance_mode');
function check_maintenance_mode(){
global $pagenow;
if(defined('IN_MAINTENANCE') && IN_MAINTENANCE && $pagenow !== 'wp-login.php' && !is_user_logged_in()){
header('HTTP/1.1 Service Unavailable', true, 503);
header('Content-Type: text/html; charset=utf-8');
if(file_exists(WP_CONTENT_DIR . '/maintenance.php')){
require_once( WP_CONTENT_DIR . '/maintenance.php' );
}
die();
}
}
The IN_MAINTENANCE
and WP_CONTENT_DIR
constants are initialised and setted by me.
Anyway, this code suddenly stopped to work. The website is always visible even with IN_MAINTENANCE setted to true. By logging from the function, I can confirm that all the conditions are true and it really throw the headers and require the maintenance.php file, but it doesn't.
Any idea?
本文标签: How to programmatically put wordpress in maintenance mode
版权声明:本文标题:How to programmatically put wordpress in maintenance mode 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745330105a2653771.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论