I have a news website with over 3000 posts. The previous website builder did not use the built-in functionality of Wordpress for the featured image, but used an ACF (Pro) image field instead.
On the new website I would like to use the standard function of Wordpress. I just have no idea how to set the images from the ACF (Pro) image field as a featured image via the built-in Wordpress function.
Is there a script that can do that automatically? I don't like having to do more than 3000 messages manually.
So the image should be from this:
To this:
I've searched all over the internet for a solution to this, but couldn't find anything.
Thank you very much in advance for any help.


We can make a simple script to fix your post thumbnails.
For easiest implementation lets just add this function to your
functions.phpwhich will run when we your site loads.You want to run this on over 3000 news posts. This means your site will take a few moments, maybe minutes, to run the script before your site eventually loads.
If you are using this on a live environment, lets add a URL parameter to only allow this to run when param is true, for example...
https://www.example.com/?fix_post_thumbs=true
Here is the code you need to add to your functions
functions.php...Please read comments in code so you know what is happening.
This is not tested, you may want to test on some specific news post ids first via
WP_Query, usingpost__into only run this on selected posts.Update: I've added a
print_r()information showing count of how many featured images have been set once process has completed.Plugin Update: As suggested I've created a simple plugin which you access via the Tools menu when plugin is activated.
Simply select the post type you wish to run this function on, then select the ACF image field
nameyou want to set as thepost_thumbnail, and click run.If ACF image field for current post has no attachment value, the function will skip this post and continue processing.
See git repo plugin link below...
https://github.com/joshmoto/acf-image-set-post-thumbnail
Or download this distribution version below to install via uploading zip file to your plugins...
acf-image-set-post-thumbnail.zip