Custom Post Permission Issue with Custom Role
-
Hello, i’m facing a strange issue in WordPress.
I have created a custom post type with
"capability_type" => array('my_post','my_posts'), "map_meta_cap" => true,And then create custom role, and add the capabililities this to the role so that user in that role can access the custom post type:
$role = get_role('my_role'); // This only works, because it accesses the class instance. // would allow the subscriber to edit others' posts for current theme only $role->add_cap('read'); $role->add_cap('read_my_post'); $role->add_cap('delete_my_post' ); $role->add_cap('edit_my_posts'); $role->add_cap('edit_others_my_posts' ); $role->add_cap('delete_my_posts' ); $role->add_cap('publish_my_posts' ); $role->add_cap('read_private_my_posts'); $role->add_cap('delete_private_my_posts'); $role->add_cap('delete_published_my_posts' ); $role->add_cap('delete_others_my_posts' ); $role->add_cap('edit_private_my_posts' ); $role->add_cap('edit_published_my_posts' ); $role->add_cap('edit_my_posts' );Now when i logged in a user with the “my_role” role, i can see the post type in WordPress menu, but when i click on it (to open the post list page from where i can edit/delete/add post) it’s showing me “Sorry you are not allowed to access this page”.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
The topic ‘Custom Post Permission Issue with Custom Role’ is closed to new replies.