这与用户没有正确设置CPT功能访问有关。
我将自定义功能设置为:
\'capabilities\' => array(
\'publish_posts\' => \'publish_\' .$this->type,
\'edit_posts\' => \'edit_\' .$this->type,
\'edit_others_posts\' => \'edit_others_\' .$this->type,
\'edit_published_posts\' => \'edit_published_\' .$this->type,
\'delete_posts\' => \'delete_\' .$this->type,
\'delete_others_posts\' => \'delete_others_\' .$this->type,
\'read_private_posts\' => \'read_private_\' .$this->type,
\'edit_post\' => \'edit_\' .$this->type,
\'delete_post\' => \'delete_\' .$this->type,
\'read_post\' => \'read_\' .$this->type
),
在代码中,理想情况下,当插件被激活时,我应该有一个为我想要的用户设置功能的代码(这来自我构建的类,options成员有一个具有自定义功能的数组)
$capabilities = $this->options[\'capabilities\'];
$admin_role = get_role( \'administrator\' );
$editor_role = get_role( \'editor\' );
foreach ( $capabilities as $capabilities => $capability_name ) {
$admin_role->add_cap( $capability_name );
// $editor_role->add_cap( $capability_name );
}
一旦我弄乱了这些设置,修订工作就如预期的那样。