Hello again @hube2,
Is there a way to make the post_thumbnail_id the first item in the gallery and not the last?
The code you posted works correctly, but the thumbnail is added as the last item in the gallery.
I would appreciate some help on this, please.