WordPress页面模板进行开发后台移除默认编辑器
在Wordpress开发过程中,很多时候,需要用到页面模板进行开发,这时候很可能会成为累赘,比如:某联系页面,你建立了很多字段,电话、姓名、邮箱等,默认编辑器成了摆设,为了让客户更好的使用后台,这时候我们需要移除后台的默认编辑器:将如下代码添加到functions.php中就好!
//移除某个页面的编辑器
add_action( 'admin_init', 'themetuts_remove_editor' );
function themetuts_remove_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 == 'page-contact.php'||$template_file ==
'page-profile.php'||$template_file == 'page-process.php'){
// edit the template name
remove_post_type_support('page', 'editor');
}
}
关注公众号:拾黑(shiheibook)了解更多
[广告]赞助链接:
四季很好,只要有你,文娱排行榜:https://www.yaopaiming.com/
让资讯触达的更精准有趣:https://www.0xu.cn/

随时掌握互联网精彩
赞助链接
排名
热点
搜索指数
- 1 总书记的“家园”之喻 7904758
- 2 744分考上清华的庞众望现状曝光 7807952
- 3 女生兼职给LABUBU钩衣服月入超2万 7714277
- 4 听听青年的网络文明“关键词” 7618185
- 5 阿里离职员工发万字长文 马云回应 7520131
- 6 重庆首富身家缩水1000亿 7428772
- 7 洛杉矶已面目全非 7333467
- 8 哪吒汽车CEO被员工围堵在办公室 7236073
- 9 李晨晒哥斯拉LABUBU 7137738
- 10 种粮大户的“丰收密码” 7042354