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 逐梦苍穹 习近平引领航天强国建设 4901926
- 2 夫妻养2.8万只鸡 为省人工自己捡蛋 4940468
- 3 职高女孩逆袭成双一流大学研究生 4864200
- 4 解码首季经济成绩单 4724111
- 5 女子火车上如厕时130g黄金掉落铁轨 4608497
- 6 华人夫妇日本遇害细节曝光 4514676
- 7 神十八点火瞬间航天员齐刷刷敬礼 4430301
- 8 余承东把问界M9送到360楼下 4372032
- 9 深圳部分区域将取消限购不实 4220781
- 10 男子腰缠4斤珍珠入境被拦 4134046