custom post type with categories and tags – checkbox disabled
-
Hi everyone,
I’m having a small problem with a plugin i’ve created. I’m trying to give the users permission to add categories and tags to the custom post type but the tag box is half loaded and the categories box checkboxes are disabled. After some test I’ve found that I need to give the users the permission to edit_posts in order to get this working but I cannot do this. This is the code I used to create the custom post. Is there any way to remap that permission to my own capability ?
function liens_pc_create_post_type() { // Capacités du plugin (Permissions) $capabilities = array( 'publish_posts' => 'publish_lienpcs', 'edit_posts' => 'edit_lienpcs', 'edit_others_posts' => 'edit_others_lienpcs', 'delete_posts' => 'delete_lienpcs', 'delete_others_posts' => 'delete_others_lienpcs', 'read_private_posts' => 'read_private_lienpcs', 'edit_post' => 'edit_lienpc', 'delete_post' => 'delete_lienpc', 'read_post' => 'read_lienpc' ); // Étiquettes du plugin $labels = array( 'name' => 'Bibliothèque de liens', 'singular_name' => 'Lien', 'add_new' => 'Ajouter un lien ', 'add_new_item' => 'Ajouter un lien', 'edit_item' => 'Modifier le lien', 'new_item' => 'Nouveau lien', 'all_items' => 'Tous les liens', 'view_item' => 'Voir le lien', 'search_items' => 'Trouver le lien', 'not_found' => 'Aucun lien(s) trouvé', 'not_found_in_trash' => 'Aucun lien trouvé dans la corbeille', 'parent_item_colon' => '', 'menu_name' => 'Bibliothèque de Liens', ); //register post type register_post_type( 'liens_pc', array( 'labels' => $labels, 'has_archive' => true, 'public' => true, 'map_meta_cap' => true, 'supports' => array( 'title', 'author' ), 'exclude_from_search' => false, 'capability_type' => 'page', 'capabilities' => $capabilities, 'rewrite' => array( 'slug' => 'liens_pc' ), 'taxonomies' => array('category','post_tag'), //'register_meta_box_cb'=> 'liens_pc_load_scripts_add' ) ); flush_rewrite_rules(false); }
Any help would be appreciated . Thanks.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘custom post type with categories and tags – checkbox disabled’ is closed to new replies.