Display Post Object Data Inside WordPress ACF Repeater Field

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.

acf repeater object

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 🙂

Written by: Aksam Zarook
Aksam Zarook is a web designer, developer, online marketer and founder of Zeeron Solutions. With nearly 11 years of work and business experience he excels in web design, web development, graphic design and Internet marketing. He is also a family man with two adorable little kids and rides a motorbike.

Join Discussion Now!

Leave a Reply