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 旧物换新 万亿市场添“活力” 7904822
- 2 印度警方称坠机事故有1名幸存者 7808268
- 3 幸存者跳机逃生 自行从残骸中走出 7713421
- 4 中国外贸在复杂环境中稳健前行 7616085
- 5 印度失事客机乘客国籍公布 7523064
- 6 B站崩了 7429386
- 7 网警提醒:高考后考生家长仍需警惕 7330118
- 8 印度坠机已致地面多人死亡 7236200
- 9 42岁百万网红“草帽姐”确诊肝病 7143475
- 10 众星发文力挺邓紫棋 7040771