I’m using nextscripts facebook poster. I want to post on my facebook with a custom image specific for facebook and what is not used in a post.
I created with ACF a image field for post. so I can select a image for each post which I want to use with nextscripts.
Nextscripts needs a custom field with a image url.
How can I get the image url of de ACF image in a custom field?
I did some little more checks.
When I create a ACF field “FILE” then the result on frontpage is the url of the selected image file, but it’s not working with Nextscripts autoposting.
When I create a ACF field “TEXT” and paste the url of the image then it is correct posting the image file with Nextscripts .
So I’m looking for a solution that the URL of the image after select ACF field “IMAGE” or field “FILE” the url of it is autoposted in the “TEXT” field.
Because we don’t know the exact image location and first want to select or upload a new photo to the post , before the correct URL is known.
ACF stores both Image and File fields as the ID of the media attachment.
In order to put the URL into a field you’ll need to create another field to hold the URL, like a text field. Then you’ll need to create an acf/save_post filter, this is outlined here: http://www.advancedcustomfields.com/resources/acfsave_post/.
You’re filter will need to retrieve the ID value and convert it to a URL and then update the text field.
Sorry for the delayed reply on this. I did not get a notification that you had replied. Hopefully you didn’t give up.
The main problem is that ACF stores uploaded image field as the image ID value. The plugin that you’re using expects the database to hold a URL and it’s finding an ID instead.
There are 2 choices, use a text field or a URL field and then find and paste in the URL or some coding.
The coding involved is what I said above, set up your image field to return the URL of the image. In you function.php file create a save post action function. In this function you get the field from the ACF image field.
$srch = get_field('image_field_name')
Then insert the image URL into another field
update_post_meta($post_id, 'image_field_name_for_plugin', $value);
Then you can use the new field name for the plugin that needs the URL of the image.
The topic ‘Image URL’ is closed to new replies.
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!