Closed dirkil closed 3 years ago
You should be able to set the ID of your uploaded file as FeaturedMedia on your post object. So something like this (untested code):
var media = await client.Media.Create(path, name);
var post = await client.Posts.Get(id);
post.FeaturedMedia = media.Id;
await client.Posts.Update(post);
I’m closing this issue because it has been inactive for a while. Please feel free to reopen if you still encounter this issue. Thanks!
Hi there!
I guess I have a rather simple question but nevertheless I cannot get it to work.
I created a custom post type and now I want to:
I managed to upload an image by calling:
client.Media.Create(path, name)
Therefore I would appreciate if someone can explain to me how I can attach an uploaded image to my custom post type and how to set an image as the featured image.
Many thanks in advance.
Regards, Dirk