Home Forums General Issues update relational link field programmatically


update relational link field programmatically

  • Hey there, I have a relational ‘link’ field that I would like to update programmatically via function that grabs a URL from a front-end form. I’m trying to store the URL in the ‘link’ field using update_field but that doesn’t seem to be working. Not even certain if that’s a possibility.

    Can anyone make a recommendation as to how best to update a relational link field programmatically?


  • figured it out. you need to store the link information in an array before updating with update_field

    			$attachment_array = array(
    				'url' => $AttachmentURL,
    				'title' => 'link text',
    			update_field('field_604d273d1433e', $attachment_array, $post_id);
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.