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 总书记为青年创新创造鼓动风帆 7904242
- 2 国家卫健委调查肖某董某及有关机构 7809609
- 3 美方多渠道主动接触中方希望谈关税 7714220
- 4 五一假期哪些地方是打卡榜C位 7616686
- 5 五一档电影票房惨淡 7523013
- 6 女子为蹭高速免费提前半个月出发 7428691
- 7 空姐飞机上卖彩票 有人曾中25万 7331053
- 8 卫健委调查肖某董某 事件根本性升级 7235040
- 9 女生正面刘海背后寸头:现在3天一洗 7140599
- 10 老祖宗看我穿一身聚酯纤维都能笑了 7039256