I have a variable that automatic generates the url of thumb from youtube.

For example one custom post has

$video_thumb_url = 'https://img.youtube.com/vi/' . $matches_1['1'] . '/maxresdefault.jpg';

where $matches_1['1'] is the ID from Youtube.

Is there some way to take this URL and automatic upload the image in my server and then set it as featured of that relevant post?

  • Yes. Might even be multiple ways. I'd say there are at least 3 parts you need to figure out: 1. How can you access $video_thumb_url - is there any filter/action used, where the value is available? 2. How to upload this image as attachment. 3. Set the uploaded attachment as featured image – kero Dec 8 '18 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.