WordPress某页面后台移除默认编辑器

前端之家收集整理的这篇文章主要介绍了WordPress某页面后台移除默认编辑器前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

wordpress开发过程中,很多时候,需要用到页面模板进行开发,这时候很可能会成为累赘,比如:某联系页面,你建立了很多字段,电话、姓名、邮箱等,默认编辑器成了摆设,为了让客户更好的使用后台,这时候我们需要移除后台的默认编辑器:将如下代码添加到functions.PHP中就好!

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 = <a href="https://www.jb51.cc/tag/getpostmeta/" target="_blank" class="keywords">get_post_meta</a>($post_id,'_wp_page_template',true);

if($template_file == 'page-contact.<a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a>'||$template_file == 'page-profile.<a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a>'||$template_file == 'page-process.<a href="https://www.jb51.cc/tag/PHP/" target="_blank" class="keywords">PHP</a>'){ // edit the template name
    remove_post_type_support('page','editor');
}

}

原文链接:https://www.f2er.com/wordpress/67643.html

猜你在找的wordpress相关文章