Tagged: custom post, taxonomy
- This topic has 8 replies, 2 voices, and was last updated 9 years, 9 months ago by Jim Gaiko.
-
AuthorPosts
-
March 11, 2015 at 12:21 pm #5950Jim GaikoParticipant
I have a custom post type with a custom taxonomy and have given a role full permissions to this post type but the users with this role are unable to access taxonomy for these posts. The taxonomy checkboxes are visible, but are grayed out. I’ve also given this role “manage_categories” permission, but that doesn’t seem to work either. Is there something else for which the role needs perms?
March 11, 2015 at 7:33 pm #5959Syam MohanKeymasterHi Jim,
This sounds like the user doesn’t have the capability the other plugin is looking for to enable taxonomies. Is it possible for you to contact the author of other plugin and ask him/her what capability that plugin is looking for.
Thanks
Syam
March 12, 2015 at 5:37 am #5967Jim GaikoParticipantThere’s no other plugin involved – the custom taxonomy and custom post type are created from within functions.php. Here’s the code that creates the taxonomy:
//hook into the init action and call create_book_taxonomies when it fires add_action( 'init', 'create_skilltype_hierarchical_taxonomy', 0 ); //create a custom taxonomy name it topics for your posts function create_skilltype_hierarchical_taxonomy() { // Add new taxonomy, make it hierarchical like categories //first do the translations part for GUI $labels = array( 'name' => _x( 'Skill Types', 'taxonomy general name' ), 'singular_name' => _x( 'Skill Type', 'taxonomy singular name' ), 'search_items' => __( 'Search Skill Types' ), 'all_items' => __( 'All Skill Types' ), 'parent_item' => __( 'Parent Skill Type' ), 'parent_item_colon' => __( 'Parent Skill Type:' ), 'edit_item' => __( 'Edit Skill Type' ), 'update_item' => __( 'Update Skill Type' ), 'add_new_item' => __( 'Add New Skill Type' ), 'new_item_name' => __( 'New Skill Type' ), 'menu_name' => __( 'Skill Types' ), ); // Now register the taxonomy register_taxonomy('skilltype',array('skills'), array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'skilltype' ), )); }
March 12, 2015 at 7:56 pm #5999Syam MohanKeymasterThanks Jim, I’ll test with your code.
March 16, 2015 at 8:26 am #6157Jim GaikoParticipantHave you had a chance to test?
Thanks
March 16, 2015 at 12:08 pm #6180Syam MohanKeymasterHi Jim, Sorry it took a while. I was working on a feature and I wanted to finish that before working on it, so that I don’t have to merge my codes later.
I tested your code and it turns out that the user needs “edit_posts” capability instead of “manage_categories”.
I’ll have to dig deeper into the WordPress core, to find is there any way to re-point it to the custom post type capability.
Thanks
Syam
March 16, 2015 at 1:44 pm #6188Jim GaikoParticipantThanks, giving “edit posts” now allows the user to edit the custom categories on the custom post type.
Is there a way I can restrict this user from editing regular “Posts”? Or at least hide that from the dashboard menu?
Thanks for your help
March 16, 2015 at 1:47 pm #6189Syam MohanKeymasterHi Jim,
“edit_posts” allows the user to edit their own posts. Also they will be able to create new posts. But they won’t be able to publish them or edit others posts. They can submit it for review.
You can use the menu editor to remove those menu items from that role.
Hope this helps.
Thanks
Syam
March 16, 2015 at 4:04 pm #6200Jim GaikoParticipantYes, that’s what I was looking for. Thanks!
-
AuthorPosts
- The topic ‘Custom taxonomy not editable in a custom post type’ is closed to new replies.