I have written a plugin that (besides other functionality) makes posts from existing content. For each post I have one picture - how to make them featured programmatically?
I do the:
$id = wp_insert_post( $my_post ); wp_set_object_terms( $id, $cat_ids, 'category' );
and I would like my next step to be inserting $image (file path or URI) as featured image. How?
Thanks in advance.