WordPress: Disable “Add New” on Custom Post Type

前端 未结 10 915
执笔经年
执笔经年 2020-12-07 14:58

Is there any way to disable the option of adding a new post under a Custom Post Type in WordPress (3.0)? I\'ve looked into labels and arguments but can\'t find anything that

10条回答
  •  抹茶落季
    2020-12-07 15:09

    I found this simplest way for this. Just ad this code into theme’s function.php.

    function hd_add_buttons() {
        global $pagenow;
        if (is_admin()) {
            if ($_GET['post_type'] == 'custom_post_type_name') {
                echo '';
            }
        }
    }
    add_action('admin_head', 'hd_add_buttons');
    

提交回复
热议问题