• I’m using wp_insert_post to create a new post. This all works ok.

    Does anyone know how to set the Featured Image – either using this function or another one?

    Background: I’m using Contact Form 7 to capture some details & upload a file and then using the before_send_mail hook to create the post.

Viewing 1 replies (of 1 total)
  • The featured image is just a special case of an attachment image. The code that does it is in wp-admin/admin-ajax.php around line 1508 (search for ‘set-post-thumbnail’).

Viewing 1 replies (of 1 total)
  • The topic ‘Featured Image: how to set using code?’ is closed to new replies.