1

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.

  • Does this answer your question? Custom user role cannot see or modify featured image – BenB Apr 3 at 15:03
  • @BenB: I'm afraid not.I already saw that question but that was a pre-gutenberg issue with some 3rd party plugin hiding the featured image panel. My problem is gutenberg-only, I think. And the problem arises without any other plugins active... Thanks very much for your reaction, though! – Edwin Snotje Apr 4 at 6:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.