首页 > 新闻资讯 > 移除特定功能支持

移除特定功能支持

0条评论
标签:
更多

把这段代码添加到functions.php中,将在特定文章类型中删除指定功能,把“post”换成你想换成的自定义文章类型名称或者默认文章,页面。

‘title’ (Post Title)
‘editor’ (content)
‘author’ (Author controls)
‘thumbnail’ (featured image) (current theme must also support Post Thumbnails)
‘excerpt’ (Excerpt functionality)
‘trackbacks’ (Options)
‘custom-fields’ (Custom Fields)
‘comments’ (also will see comment count balloon on edit screen)
‘revisions’ (will store revisions)
‘page-attributes’ (template and menu order) (hierarchical must be true)

add_action( 'admin_init', 'wps_cpt_support' );
function wps_cpt_support() {
    remove_post_type_support( 'post', 'title' );
    remove_post_type_support( 'post', 'comments' );
}

* 版权声明:作者WordPress啦! 转载请注明出处。