Thread Starter
Begin
(@bentalgad)
Got it:
echo get_post_meta( get_the_ID(), 'wiki_test_repeat_group', true )[0][title];
Will work.
That would work. Another idea, in case you know you can’t rely on the desired data being in the same index each time would be to loop through them all and conditionally echo or pluck into its own variable that you could echo afterwards.
Thread Starter
Begin
(@bentalgad)
Yes but that would be a really long code to echo just one field…
No doubt, but *potentially* a necessary route if it’s not guaranteed to always be in index 0.
Nitpicky, but looking over the code snippet provided, may be best to quote that “title”. Otherwise it may be interpreted as an undefined constant.
echo get_post_meta( get_the_ID(), 'wiki_test_repeat_group', true )[0]['title'];
Thread Starter
Begin
(@bentalgad)
Oh, yes i actually did in my real code. thanks.
BTW – why wouldn’t be in the index 0?
It will happen only if i use repeatable fields right? if i don’t i have nothing to worry about right?
Depends on the overall structure and intent you have. Especially with a repeatable group where the order may be changed in the admin and you’re needing to output specific content in specific spots. Long story short from my end, best to know variations of how to access the data being saved. 😀