Home Forums Backend Issues (wp-admin) Image Field Documentation Needs Clarification


Image Field Documentation Needs Clarification

  • A friendly heads-up: it appears that the image custom field documentation here ( is out-of-date or inaccurate, specifically talking about return types for get_field and the_field.

    The documentation page (for return type) says: “Customize the returned data. Choose from Object (array of data), URL (string), or ID (int)”.

    Whereas the field backend selection for return value lists: Image Array, Image URL, and Image ID.

    This led to some confusion on my part because arrays and objects in php access their data differently. Arrays use the $array[‘key’] notation whereas objects use $object->member.

    I ended up scratching my head for a little while because I was under the impression (via the documentation) that the return value for get_field would be an object, and couldn’t for the life of me figure out why an ‘image’ object wouldn’t let me access it’s url member.

  • It is a little confusing, yes. The documentation does refer to an object, but it has always been returned as an array and this is seen in the code example for the image field where array values are used. I’m sure that the documentation will eventually be updated. The best way to get concerns like this to the developer is to open a new support ticket here

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

The topic ‘Image Field Documentation Needs Clarification’ is closed to new replies.