I've been developing a custom post type plugin for my own purposes and I want to understand capabilities in regards to custom post types a little better before I move forward. Unfortunately the Wordpress Codex doesn't really clear it up for me.
I just don't understand what capabilities are actually doing in regards to custom post types.
For example, when I create a custom post type called 'book' and I use 'book' as the capability_type, it generates these 7 primitive capabilities:
[edit_post] => edit_book [read_post] => read_book [delete_post] => delete_book [edit_posts] => edit_books [edit_others_posts] => edit_others_books [publish_posts] => publish_books [read_private_posts] => read_private_books
Now, can I just create any kind of capability I like? For example could I do this:
[random_capability] => edit_book
So that any user role who has the capability of edit_book can also have permission for random capability?
I've tried experimenting with it by creating two custom post types: book and fantasy-book.
I gave book that random_capability and then told fantasy-book to use book as its capability_type. Now, my understanding is that it would pull books capabilities (including random_capability) and give that capability to fantasy-book, correct?
In practice that doesn't work. I feel like capability_type should be pulling the capabilities of whatever type you give it, or create new capabilities if said type does not exist yet.
If not, then I have no idea how capability_type works and haven't been able to find anything about this. Anyone have any knowledge regarding this?
Any help is greatly appreciated.