首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

批改 页面编辑 的权限

2012-08-27 
修改 页面编辑 的权限WORDPRESS 有时候在页面编辑的时候 需要对后台进行一些自己的设置 防止客户或者某些

修改 页面编辑 的权限

WORDPRESS

有时候在页面编辑的时候 需要对后台进行一些自己的设置 防止客户或者某些人进行不规则举动来编辑页面

造成网站的破坏,

此时我们需要对某些页面进行 特定的处理 可以设置某些模板的页面的编辑功能不可用

这样我们需要在functions.php加入以下代码

改掉下面的_wp_page_template 为你的自己定义的模板如此,只要引用此模板的页面都是不可见的了。?add_action( 'admin_init', 'hide_editor' );function hide_editor() {    $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;    if( !isset( $post_id ) ) return;    $template_file = get_post_meta($post_id, '_wp_page_template', true);    if($template_file == 'submit.php'){ // edit the template name        remove_post_type_support('page', 'editor');    }}
?

热点排行