WordPress 创建自定义文章类型 禁用Add New 新增/添加功能

前篇我们写了 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 );
厂家CPU内存硬盘流量价格购买链接
RamNode11GB25GB-SSD500GB/mUSD $5购买
DigitalOcean11GB25GB-SSD1000GB/mUSD $5/m购买
腾讯云Qcloud22GB50GB-SSD购买
Vultr11GB25GB-SSD1000GB/mUSD $5/m购买

已发布

分类

作者:

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注