Gutenberg Featured-Image-panel missing when user with custom role edits Custom Post Type

For a WordPress project I made a Custom Post Type in the usual manner. Also i made a custom role. I want users with that role to be able to make, edit and delete this CPT. I added the apropriate capabilities to this role. These are the caps:

'level_1' => true, // seems necessary to asign this author as a post_author by other users
'read' => true,
'view_admin_dashboard' => true,
'upload_files' => true,
'publish_{my_cpts}' => true,
'edit_{my_cpts}' => true,
'edit_others_{my_cpts}' => false,
'delete_{my_cpts}' => true,
'delete_others_{my_cpts}' => false,
'read_private_{my_cpts}' => true,
'edit_{my_cpt}' => true,
'delete_{my_cpt}' => true,
'read_{my_cpt}' => true

I map these capabilities also in the args for adding the cpt. Upon making the CPT, I did not forget to add ‘thumbnail’ to the ‘supports’ argument. And i added theme-support for thumbnails, also for my cpt

However, i don’t want users with this role to be able to edit ordinary posts.

I think i don’t need to provide more details on this because everything works fine.

Except for the featured image panel in Gutenberg. This panel seems to display only if a user has the edit_posts capability, which my users don’t have. The panel shows for other users, it only remains hidden for users with my custom role.

For now, I made a workaround with an ACF-image field. Images uploaded with this custom field I make the featured-image in a save_post hook.

But this is a workaround, I prefer the usual panel. Any suggestions? I find this an unusual hard nut to crack.

0

Leave a Comment