无法在Wordpress中编辑新的自定义分类

时间:2013-11-06 15:43:55

标签: wordpress

我刚刚注册了一个新的Custom Taxonomy in Wordpress(根据文档)。以下是functions.php中代码的副本供参考:

function people_init() {
    // create a new taxonomy
    register_taxonomy(
        'people',
        'post',
        array(
            'label' => __( 'People' ),
            'rewrite' => array( 'slug' => 'person' ),
            'capabilities' => array(
                'assign_terms' => 'edit_guides',
                'edit_terms' => 'publish_guides'
            )
        )
    );
}
add_action( 'init', 'people_init' );

如下图所示,分类标准显示在左侧导航栏中,但当我的(管理员)用户点击选项时,我显示的是您不允许编辑此项目。错误:

Preview of the error

有谁能说明为什么会这样?

1 个答案:

答案 0 :(得分:9)

几乎在我发布此消息后,我意识到它是capabilities数组。删除它,以便恢复为默认值允许按预期进行访问。

经过进一步调查后,我发现以下是正确运行的最佳设置:

'capabilities' => array(
    'manage__terms' => 'edit_posts',
    'edit_terms' => 'manage_categories',
    'delete_terms' => 'manage_categories',
    'assign_terms' => 'edit_posts'
)