您的购物车目前是空的!
最近在给客户弄一个基于WordPress的OA系统,前台禁止访问。仅供后台使用。这边我们记录一下,如何禁止使用前端主题。开启维护模式。
为什么要启用维护模式?
开启维护模式也很简单,我们需要打开WordPress当前模板目录中的functions.php
添加如下代码:
function maintenance_mode() { if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) { wp_die('站点维护中,请稍后再来.'); } } add_action('get_header', 'maintenance_mode');
保存上传就开启了维护模式。