是否可以隐藏自定义帖子类型的正文复制框?

时间:2015-02-04 作者:ReynierPM

我正在使用Wordpress Types 用于在我的博客上创建和管理自定义帖子类型(CPT),效果非常好。我创建了一个名为Espacio Publicitario的CPT,还添加了一些自定义字段(见下图)。我要躲起来body copy box 既然这个CPT没用,我能做到吗?怎样它将仅为本CPT隐藏,而不是为其余的帖子、页面等隐藏

enter image description here

2 个回复
最合适的回答,由SO网友:61Pixels 整理而成

有一个内置的WordPress函数,remove_post_type_support http://codex.wordpress.org/Function_Reference/remove_post_type_support .

在你的情况下,你可以使用

add_action( \'init\', \'my_custom_init\' );
function my_custom_init() {
    remove_post_type_support( \'custom_post_type_name\', \'editor\' );
}

SO网友:Khursheed Alam

是的,您可以在创建自定义帖子类型时使用register_post_type( $post_type, $args )
功能。不要在supports参数中使用“editor”。

register_post_type(\'posttype name\',$args);  
$args = array(  
        \'labels\' => $labels,  
        \'public\' => true,  
        \'publicly_queryable\' => true,  
        \'show_ui\' => true,   
        \'show_in_menu\' => true,   
        \'query_var\' => true,  
        \'rewrite\' => true,   
        \'capability_type\' => \'post\',  
        \'has_archive\' => true,   
        \'hierarchical\' => false,  
        // on the supports param here you see no \'editor\'  
        \'supports\' => array(\'title\',\'author\',\'thumbnail\',\'excerpt\',\'comments\')    
    ); 

结束