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 推动不同文明交流对话、和谐共生 7904149
- 2 莫迪好尴尬:印度神都是中国造 7809683
- 3 王钰栋点球绝杀 国足1比0巴林 7713533
- 4 古今碰撞 绘出网络文明“新画卷” 7617988
- 5 国足比赛男球迷3次试图亲女伴遭拒 7520251
- 6 男子吃见手青中毒一直帮凤凰捋毛 7423634
- 7 中国的垃圾不够烧了 7332785
- 8 薄荷色LABUBU拍出108万天价 7237383
- 9 国产剧这次真高级 7143789
- 10 聚焦就业教育等民生保障最关键问题 7042797