using add_role function to make some users to create a selected type post

how are you ?

I have in my site (post_type called = books)..

I need to make some users for example (Library) to create a books (post_type = books) ..

this is the code to add rols (called = library) ..

$library = add_role('library', 'library', array(
    'read' => true, 
    'edit_posts' => true,
    'delete_posts' => false, 

The library Role can create (any type of post) , I want it to create books (post_type) ..

I wish you understand me ..

thank you very much ^_^

1 Answer

You can add your own capabilities for custom post types. The default behvaiour for a post type is to inherit capabilities from the default post post-type.

See the capabilities parameter in register_post_type (WordPress Codex), that has more information about how that can be done.

Leave a Comment