Home › Forums › General Issues › get_field() doesn't return a value when fields are created with update_field() › Reply To: get_field() doesn't return a value when fields are created with update_field()
This is what I’ve already done and it works of course. But it’s a bit annoying, especially when you have plenty of custom fields.
I’ve read the documentation before posting the first post, but the explanation isn’t 100% clear to me. I still don’t fully understand the following issues:
1. Why the post don’t exist yet when it’s created with
wp_insert_post returns the post ID, so I assume that post is already created.
2. When I use fields names instead of fields keys then I can see fields values when I enter the post edit page in the WP admin. How is it possible?
3. When I re-save the post manually then values set previously by
update_field() function (using fields names, not keys!) are properly saved. How is it happening? What happens when I save the post manually, and why it can’t be done programmatically? I assume it’s not any magic 🙂
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!