Support

Account

Home Forums General Issues Using Post Object Relationship field with add_post_meta in front end form Reply To: Using Post Object Relationship field with add_post_meta in front end form

  • Just a word of warning, the post object field will not be picked up correctly if used on the front end of the site unless you edit/save the post in the admin… well depending on what you’re returning. If you’re returning the post ID then you’ll be fine but if you try to get the post object then it will still only return the post ID. In order to get ACF to return the post object on the front end you also need to save the field key reference to the database. That would look something like this

    
    add_post_meta($post, '_apartment', 'field_012345', true);