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 总书记要求用好这把“戒尺” 4967135
- 2 以色列对伊朗发动导弹袭击 4963742
- 3 广州天河驾车撞人案罪犯被执行死刑 4802743
- 4 从消博会看消费新趋势 4713545
- 5 抗战烈士墓发现年轻女子照片 4686730
- 6 12306一种新的存钱方式 4552781
- 7 女子蒙对支付宝口令领走1万元被抓 4481691
- 8 比特币再巨震 超7万人爆仓 4396328
- 9 客服辟谣在12306公众号求票成功 4292612
- 10 杨幂美甲事件引争议 4187662