在更新程序或插件中,WordPress前端会显示处于维护模式,如果想临时启用维护模式,让用户知道你的站点在维护中,可以通过下面的代码实现。
将下面代码添加到当前主题函数模板functions.php中:
function zm_maintenancemode() { if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) { wp_die('网站正在维护请稍候!'); exit; } } add_action('get_header', 'zm_maintenancemode');
添加代码后,前端会显示维护中,但不影响登录后台操作。
出处:http://www.thecreativedev.com/how-to-put-wordpress-site-into-maintenance-mode/
文章来源:知更鸟官网,https://zmingcx.com/wordpress-site-into-maintenance-mode.html

星光博客 站长语录
星光博客,欢迎各位来访!这是我的QQ,扫一扫,加好友。大家一起交流博客建站技术,分享前沿资讯!