ACF Repeater Field Value

WordPress Resolved
July 24, 2019 10: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?
July 24, 2019 11:30:34
E2Pdf
Topics: 7
Messages: 3614
Support
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!
July 24, 2019 11: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.
July 24, 2019 12:03:55
E2Pdf
Topics: 7
Messages: 3614
Support
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!
Get News and Updates
Our monthly newsletter keeps you in the loop, so you'll always be up to date with the latest news and updates about E2Pdf.
* You can update your email subscription preferences here.
All trademarks, service marks, trade names, product names, and logos appearing on this website are the property of their respective owners. The use of trademarks such as Formidable Forms®, Forminator Forms®, Gravity Forms®, JetFormBuilder®, WordPress®, WooCommerce®, WPForms® and others is solely for identification purposes (nominative use) and does not imply any affiliation, sponsorship, or endorsement by the respective trademark holders.
© 2017 - 2026, https://e2pdf.com

We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements. By clicking "Accept Selected", you consent to use of selected cookies according to our Cookie Policy.