Home › Forums › General Issues › Setting the post Featured Image based on (PDF) File upload field thumbnail › Reply To: Setting the post Featured Image based on (PDF) File upload field thumbnail
Sorry I just took another look at your code and found the issue – in update_post_meta, you are setting the value of the _thumbnail_id meta to the variable $downloadcenter_id which has not been defined.
Update that line to the following –
update_post_meta($post_id, '_thumbnail_id', $attachment_id);
Test and let me know if you still have any issues with it!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Plugin boilerplates can do some of the heavy lifting during initial development. We look at four options to speed up your plugin creation. https://t.co/ZtMsdBxAHw— Advanced Custom Fields (@wp_acf) June 5, 2023
© 2023 Advanced Custom Fields.