Support

Account

Home Forums General Issues Right way in PHP to set an image field to a particular media post id?

Unread

Right way in PHP to set an image field to a particular media post id?

  • Hi there, I need to use PHP to set an image field to an attachment post id (an existing image in the media library). If I use update_field(‘my_image_field’, attachment_id, post_id) then fetch that image field with get_field(), it just returns the attachment id e.g. “123” instead of an array which is what is normally returned if I set the image via the WP backend.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.