WordPress.org

Ready to get started?Download WordPress

Forums

custom taxonomy - can't change selections when editing post (4 posts)

  1. Upstreet Media
    Member
    Posted 2 years ago #

    Hello,

    I have a custom taxonomy (see below for the arguments). When I login as an Author and I edit one of the stories that belongs to the Author, the terms are visibile but the checkboxes are disabled.

    But, I have set the "assign_terms" to true and according to the code in wp-admin/includes/meta-boxes.php, they should NOT be disabled since I have assign_terms set to true:

    From wp-admin/includes/meta-boxes.php:
    $disabled = !current_user_can($taxonomy->cap->assign_terms) ? 'disabled="disabled"' : '';

    My Custom Taxonomy args:

    , 'rating' => Array(
    		'object_type' => Array('fiction')
    		, 'args' => Array(
    			'labels' => Array(
    				'name' => 'Ratings'
    				, 'singular_name' => 'Rating'
    				, 'add_new_item' => 'Add New Rating'
    				, 'new_item_name' => 'New Rating Name'
    				, 'edit_item' => 'Edit Rating'
    				, 'update_item' => 'Update Rating'
    				, 'search_items' => 'Search Ratings'
    				, 'popular_items' => 'Popular Ratings'
    				, 'all_items' => 'All Ratings'
    				, 'parent_item' => 'Parent Rating'
    				, 'parent_item_colon' => 'Parent Rating:'
    				, 'add_or_remove_items' => 'Add or remove ratings'
    				, 'separate_items_with_commas' => 'Separate ratings with commas'
    				, 'choose_from_most_used' => 'All Ratings'
    			)
    			, 'public' => true
    			, 'hierarchical' => true
    			, 'rewrite' => true
    			, 'query_var' => true
    			, 'capabilities' => array(
    				'manage_terms' => false
    				,'edit_terms' => false
    				,'delete_terms' => false
    				,'assign_terms' => true
    				)
    		)
    		, 'terms' => Array(
    			'G' => Array()
    			, 'PG' => Array()
    			, 'PG-13' => Array()
    			, 'R' => Array()
    			, 'NC-17' => Array()
    		)
    	)
  2. fonglh
    Member
    Posted 2 years ago #

    'capabilities' => array(
    				'manage_terms' => false
    				,'edit_terms' => false
    				,'delete_terms' => false
    				,'assign_terms' => true
    				)

    you need to map these to the actual wordpress capability names, not just assign true/false values. see the documentation for the register_taxonomy function.

    http://codex.wordpress.org/Function_Reference/register_taxonomy

  3. Upstreet Media
    Member
    Posted 2 years ago #

    Thanks. I think I'm a bit more confused now.

    capabilities
    (array) (optional) An array of the capabilities for this taxonomy.
    Default: None
    'manage_terms' - 'manage_categories'
    'edit_terms' - 'manage_categories'
    'delete_terms' - 'manage_categories'
    'assign_terms' - 'edit_posts'

    this is very vague. not a lot of information. :/

  4. Upstreet Media
    Member
    Posted 2 years ago #

    figured it out. thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic