Hi, I was hoping somebody could point me in the right direction with this one.
We have added the image field in the backend, where one can choose a picture. After this the thumbnail is shown in the backend, and the image shows up in the sidebar of the site. The custom field is CE, (short for camera eye).
Since we migrated from a joomla site, this field was introduced in may 2019.
To have an image with all the old posts before may 2019, a direct link to the file was added in the sql database, the meta key CE has a link to an image in the meta value.
A huge mistake.
The future new articles, which have the image uploaded via the custom field in the backend, the system works differently. ACF makes a new post id, which it puts as the meta value for the meta key ce. the post id then stores three items,
Whenever now somebody updates an old post from before may 2019, the link in the cd field is erased, since in the backend the image is not present. Needless to say this poses a problem.
Therefore I need to mass update the image field, so that the values in the sql postmeta table look like the posts made with the custom image field.
As an example for one post I put together the following.
Will this work, how do I implement it so that it only runs once per post, then never again ?
help and advise very welcome.
update_field( ‘ce’, ‘http://localhost/offline2020/wp-content/uploads/2018/01/eelsce2018.png’, $post_id );’