Recently, I was developing a complex WordPress custom post type page for a Travel web design project. I used the WordPress ACF plugin and its premium ACF Repeater field plugin to develop the backend. It all worked fine and was saving user input data beautifully. However, I had a time with displaying the Post Object data that were contained inside a WordPress ACF Repear Field before I found the trick.
First, I read the documentation for post object at the Advanced Custom Field site and used their code but it didn’t work. After checking out more similar threads on StackOverflow etc., I finally stumbled on Bryan Hoffman’s blog post “ACF: Get Post Object data within a Repeater” which showed me the error in my coding. It’s simple and I think the ACF documentation should include it as a tip.
1) To display or get post object data within a ACF repeter field, use the same code to display post object data from ACF documentation.
2) Then edit and replace, “$post_object = get_field(‘post_object’);” with, “$post_object = get_sub_field(‘your_field_name’);”
That’s it 🙂