ACF Repeater Field Value

WordPress Resolved
24 July, 2019 03:42:17
ECL
Topics: 1
Messages: 2
I'm trying to access the first item of an Advanced Custom Fields Repeater field. I'm using [meta key="inline_testimonials" path="0.inline_testimonials_text"] (based on [meta key="mymeta" path="0.name"] as the documentation suggests) but this doesn't return the correct value (just returns a string of '1'). When I dump the field the array structure is as follows:

array(1) {
[0] =>
array(2) {
["inline_testimonials_text"] =>
string(198) "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris condimentum mauris quis turpis finibus, et gravida sapien ullamcorper. Nulla fringilla mi a rutrum elementum. Nunc augue leo, pretium."
["inline_testimonials_author"] =>
string(56) "Enter persons name, role in business and name of company"
}
}

Can you advise how I can access the value I need to display in my PDF?
24 July, 2019 04:30:34
E2Pdf
Support
Topics: 7
Messages: 3176
Hi,

Can you please output here the result of [meta key="inline_testimonials"] inside "textarea" filed?

We remain at your service.
We would really appreciate your feedback at WordPress.org!
24 July, 2019 04:56:56
ECL
Topics: 1
Messages: 2
Thank you for replying, I worked out the issue. I needed to use get_post_meta to obtain the correct meta key for the field rather than ACF's get_field() function.
24 July, 2019 05:03:55
E2Pdf
Support
Topics: 7
Messages: 3176
Just a tip: you can output [meta key="value"] without path. If resulted string will be array - value will be serialized. You can easily unserialize it and get the correct path.

We remain at your service.
We would really appreciate your feedback at WordPress.org!