I am trying to set thumbnails for my post.
I have post_id = 285 and I want to add manually a thumbnail (using code) but I'm not succeeding.
update_post_meta( $post->ID, '_thumbnail_id', $attachment_id );
I got this function reference but I do not understand what is the $attachment_id and how can I get it.
I have also image name and path of image.