my question is about using wp_insert_post to insert post with type “photo”
not needs to upload the image right now just I want to insert the post information into the database
I used this code and it is working
$my_post = array(
'post_title' => 'My post',
'post_content' => 'This is my post.',
'post_status' => 'publish',
'post_author' => 1,
'post_type' => 'photo',
'post_category' => array(3)
);
the question is I want to add the following informations
1- the photo type
2- I want to set the post as a featured Image
You first need to upload the file, then you can attach the image as an attachment to your post. This is the code I use to automate a blog: