jjgrainger / wp-custom-post-type-class

A PHP Class for creating Wordpress Custom Post Types easily
MIT License
416 stars 114 forks source link

Custom capabilities in CPT #30

Closed q2amarket closed 9 years ago

q2amarket commented 9 years ago

It's nice class. However, it could be even better by adding custom capabilities option. Are you planning or give some sort of idea to add it?

jjgrainger commented 9 years ago

This can be achieved through the second parameter passed when constructing the post type with the class (codex). example:

$books = new CPT('book', array(
    'capability_type' => array('book', 'books'),
    'map_meta_cap' => true
));

There are other arguments such as capabilities which the above will build automatically for you. It's just how you assign the new custom capabilities to the different user roles within WordPress there after. (example here: stackoverflow)

At first glance, I can't imagine a way the class would be able to do this that is simple and easy to use while also being flexible enough to allow for a variety of situations? I don't know.

Still it would be worth looking into.

q2amarket commented 9 years ago

Yeah I realized that later I open an issue. Thanks a lot for nice library...!