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
Hey @ulinn
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.