Greetings,
Hope you’re having a good day. I’m trying it for quite sometime but I couldn’t actually get it right.
-What I have:
I’ve a text field that intakes URL. I included the URL of my image (that I’m hosting via CDN). It is saved as ACF field and when I’m output it to just to debug, it is shown as image (if I use tag and pointing that as src)
-What I did:
I know there are functionalities to add in function.php that will take the text field and store it as image (uploading it to WordPress library) then setting it as post_thumbnail. I basically somehow did that and it worked out once. But I lost that code now
-What I actually want
Basically to replace the plugin FIFU, there are many plugins in my dashboard, I know coding so I thought of replacing it.
-What functionality I want in it
To take the URL from my ACF that is a text, set that as Featured Image (without saving it in media library). Please note, I don’t want it to be saved in media library since I’m using an image CDN and don’t want to increase my site load. Thanks a lot for your time. Hope I’ll get some help, it’ll mean a lot!
A featured image in WP is set by setting the meta_key ‘_thumbnail_id’ in for the post to the ID of an image in the media folder. There is not a way to set the featured image using a URL it the image is not imported into media.
It might be possible to add filters to all of the WP functions the get and/or display the featured image to replace the URL in some places. If this can be done would depend on what the theme is using to display the featured image and adding filters to your functions.php file to modify the return for those functions.