我创建了三种新的自定义帖子类型,它们对我的管理员用户都很好。具有编辑器角色的用户可以在管理中查看菜单项,但当他们单击其中一项时,会显示:
对不起,不允许您访问此页面
这让我抓狂,知道我错过了什么吗?
// The custom function MUST be hooked to the init action hook
add_action( \'init\', \'handbook_noodles_post_type\', 0 );
// A custom function that calls register_post_type
function handbook_noodles_post_type()
{
// Set various pieces of text, $labels is used inside the $args array
$labels = array(
\'name\' => \'Noodles\\\'s Handbook\',
\'singular_name\' => \'Noodles\\\'s Page\',
\'add_new\' => __( \'Add New Page\' ),
\'add_new_item\' => \'Add New Page\',
\'edit_item\' => \'Edit Page\',
);
// Set various pieces of information about the post type
$args = array(
\'labels\' => $labels,
\'description\' => \'Noodles\\\'s Handbook Pages\',
\'public\' => true,
\'exclude_from_search\' => true,
\'query_var\' => false,
\'show_in_menu\' => \'employee_handbook.php\',
\'supports\' => array(\'title\', \'editor\', \'page-attributes\'),
\'hierarchical\' => true,
\'has_archive\' => true,
\'capability_type\' => \'post\',
\'map_meta_cap\' => true
);
register_post_type( \'noodles-handbook\', $args );
}