Support

Account

Home Forums Bug Reports wp-json acf image url

Solving

wp-json acf image url

  • I am using wp-json to get all custom posts with acf fields.

    I have set a image field with URL as return format but everytime I only get the ID, same for array.

    ../wp-json/wp/v2/colour?per_page=5000&_fields=title,categories,id,acf

    {
    "id": 26590,
    "title": {
    "rendered": "title test"
    },
    "categories": [
    53
    ],
    "acf": {
    "outside_image": 26898, // this should be image url
    "title": "Silver",
    "colour": "#C5C7C5"
    }
    }

    Is it me doing something wrong or is this a bug?

  • I’m having a similar issue. My ACF image field is set to return the URL but when I call the field from a twig template I get back an integer, which I think is the ID number.

  • looks like value is empty/null for all, image not getting stored

    return_format: “url”
    type: “image”
    value: “null”

  • removed all my custom posts and did a import with WP All Import Pro, now I have image urls in rest api but when I open the post, I cant see the image there

  • I’ve had a look at the actual database entry for my custom field in wp_postmeta

    The meta_value is being stored as an integer rather than as a URL.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.