前篇我们写了 WordPress插件开发 移除 Edit | Quick Edit | Trash | View 功能 图文教程 ,即使是这样,但是创建自定义文章时依然会有Add New按钮出现,下面我们给出自定义文章类型,如何禁止Add New按钮
$args = array( 'label' => __( 'Custom Post Type', 'text_domain' ), 'description' => __( 'Custom Post Type', 'text_domain' ), 'capability_type' => 'custom_post_type', 'capabilities' => array( 'create_posts' => false,//这里禁用创建功能 ), ); register_post_type( 'custom_post_type', $args );