create_posts capability not mapped.
-
Hello,
I’m trying to map the capability create_posts for posts, pages and custom posts.
So I’m doing this :
function fix_capability_create(){ $post_types = get_post_types( array(),'objects' ); foreach ( $post_types as $post_type ) { $cap = "create_".$post_type->name; $post_type->cap->create_posts = $cap; } } add_action( 'init', 'fix_capability_create',100);
In the “user role editor” I can’t see the new cap create_posts or “create_”.$post_type->name (create_books).
In user role editor if I add the cap create_books then everything works like a charm… but this is a tedious task for each projects and more when we have several post_types created by cpt-onomies.
Any idea ? I was trying “map_meta_cap( $cap, 1);” or ” $role->add_cap( $cap ); ” (yes, $role was defined) but without success.
thanks in advance.
Pepe
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘create_posts capability not mapped.’ is closed to new replies.