Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am not sure how to add multiple capabilities to 'assign_terms' capability.

My code is below, notice the capabilities array within the register_taxonomy function

/* Registers taxonomies. */

function cflnk_wod_score_register_taxonomies() {
/* Set up the artist taxonomy arguments. */
$wod_name_args = array(
    'hierarchical' => false,
    'query_var' => 'wod_name', 
    'show_tagcloud' => true,
        'rewrite' => array(
            'slug' => 'wod/name',
            'with_front' => false 
            ),
    here --->>> 'capabilities' => array (
            'manage_terms' => 'administrator',
            'edit_terms' => 'administrator',
            'delete_terms' => 'administrator',
            'assign_terms' => 'administrator', 'editor', 'author', 'contributor'
            ),
    'labels' => array(
        'name' => 'WOD Names',
        'singular_name' => 'WOD Name',
        'edit_item' => 'Edit WOD Name',
        'update_item' => 'Update WOD Name',
        'add_new_item' => 'Add New WOD Name',
        'new_item_name' => 'New WOD Name Name',
        'all_items' => 'All WOD Names',
        'search_items' => 'Search WOD Names',
        'popular_items' => 'Popular WOD Names',
        'separate_items_with_commas' => 'Separate wod names with commas',
        'add_or_remove_items' => 'Add or remove wod names',
        'choose_from_most_used' => 'Choose from the most popular wod names',
    ),
);
share|improve this question
add comment

1 Answer 1

up vote 8 down vote accepted

When assigning capabilities to 'capabilities' argument of register_taxonomy() you need to assign the capability and not the role! so use capabilities that only a specific role has eg:

'capabilities' => array (
            'manage_terms' => 'manage_options', //by default only admin
            'edit_terms' => 'manage_options',
            'delete_terms' => 'manage_options',
            'assign_terms' => 'edit_posts'  // means administrator', 'editor', 'author', 'contributor'
            )
share|improve this answer
    
Thank you, I really appreciate your help. –  Michael Sablatura May 7 '11 at 11:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.