Custom user role cannot see or modify featured image

Users that are only assigned to your event_admin role, don’t have the upload_files capability, needed to display the featured image meta box.

Here’s the relevant code from the core:

if ( $thumbnail_support && current_user_can( 'upload_files' ) )    // <-- Notice this check
    add_meta_box( 
        'postimagediv', 
        esc_html( $post_type_object->labels->featured_image ),             
        'post_thumbnail_meta_box', 
        null, 
       'side', 
       'low'
    );

Note that if you later try to add the option:

'upload_files' => true

to your add_role() setup, it might not update, since it’s cached in the wp_user_roles option.

You therefore need to update the database to adjust it:

It might also be possible to use filters like user_has_cap to adjust this dynamically.

Leave a Comment