I am creating a post with wp_insert_post/wp_update_post. The post should have a featured image. But to set a featured image I need the postID. The problem is I do not have any postID. What I am doing is. I create a "profile page" for every user. Therefore the user just updates his data in the backend. The post is created automatically out of the data.
I tied things like:
set_post_thumbnail( wp_insert_post($post), $thumbnail_id );
But is does not work.
set_post_thumbnail( wp_update_post($post), $thumbnail_id ); works. But in case I want to create a pot the first time, I need wp_insert_post.
I can provide the full code on request. Any ideas?
Thanks and regards Nico