1
当经由register_post_type()
添加自定义后类型到预先存在的菜单,编辑页面(wp-admin/edit.php?post_type=locations
)不允许视图 - 错误信息示出:You do not have sufficient permissions to access this page.
WordPress的权限问题 - register_post_type()
然而,使用主管理菜单(即'show_in_menu' = true
)允许页面正常工作。
注意:正在使用管理员帐户;被创建的链接,可见这两种方法,我想自定义职位类型通过预先存在的菜单可访问cms
使用的代码如下:
register_post_type("location", array(
"labels" => array("name" => "Locations", "singular_name" => "Location"),
"show_ui" => true,
"show_in_admin_bar" => true,
"show_in_menu" => "admin.php?page=cms", // => true : works as main menu item
"supports" => array('title'),
"show_in_nav_menus" => false,
"has_archive" => false,
"public" => true
));
希望有人能在这个问题上提出了一些问题。
中的示例它正在通过'init'钩子调用;并且大写字母是早先确定的,但不是问题。 “show_in_menu”的无效性质是什么? –
您是否阅读了法典? http://codex.wordpress.org/register_post_type#Arguments关于'show_in_menu'的部分 – janw
的确我做到了。 'cms'从'admin.php?page = cms'缩短 - 抱歉不提。我会更新预览代码。 –