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);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.