有没有简单的方法可以阻止包括管理员在内的所有用户阻止创建自定义帖子类型的新帖子。但是可以编辑。
function is_edit_page($new_edit = null){
global $pagenow,$typenow;
//make sure we are on the backend
if (!is_admin()) return false;
if($new_edit == "new" && "reviews" == $typenow)
wp_redirect( admin_url(), 302 );
}
add_action( 'current_screen', 'is_edit_page', 10, 1 );
这不起作用。
register_post_type( 'custom_post_type_name', array(
'capability_type' => 'post',
'capabilities' => array(
'create_posts' => 'do_not_allow',
),
'map_meta_cap' => true,
));
它也不起作用
它不适用于其他用户。如
shop_managers