手动开启WordPress站点维护模式
在更新程序或插件中,WordPress前端会显示处于维护模式,如果想临时启用维护模式,让用户知道你的站点在维护中,可以通过下面的代码实现。
开启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/
文章名:《手动开启WordPress站点维护模式》
文章地址:https://for.886a.top/archives/661.html
来源:for.886a.top 星空社区
本站各类资源均来自互联网,仅供个人学习交流,请于下载后 24 小时内删除,不允许用于商业用途,否则自行承担法律问题。
文章地址:https://for.886a.top/archives/661.html
来源:for.886a.top 星空社区
本站各类资源均来自互联网,仅供个人学习交流,请于下载后 24 小时内删除,不允许用于商业用途,否则自行承担法律问题。
THE END
二维码
打赏

文章目录
关闭
共有 0 条评论