Capability type and capabilities
-
Hi everybody!
I’m playing with my custom post types and got in trouble with it’s capabilities.
I created custom post type ‘hints’ which must have the same capabilities as post except that subscribers should also be able to add new content.
So I created my custom post type with capability type ‘post’ and two new capabilities:
'capability_type' => 'post', 'capabilities' => array( 'delete_posts' => 'delete_hints', 'edit_posts' => 'edit_hints', );And later assigned those new capabilities to subscriber and admin:
function add_ego_caps() { $role = get_role( 'subscriber' ); $role->add_cap( 'edit_hints' ); $role->add_cap( 'delete_hints' ); $role2 = get_role( 'administrator' ); $role2->add_cap( 'delete_hints' ); $role2->add_cap( 'edit_hints' ); }But noone can add-edit-delete hints. Both user-types can get to the editor write text for their new hint but clicking the button “publish” takes to page wich says: “You have no right to change this post”
Also are missing admins links to edit or delete posts.
Any ideas? Could this be bug?
The topic ‘Capability type and capabilities’ is closed to new replies.