[Resolved] Extracting multiple instances of audio field in REST api
The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.
I am trying to: The goal is to take advantage of the "multiple instances" option in the toolset post fields area. I selected the type as audio, this has a multiple instances allowance option selected. I would like to have multiple mp3 files attached to my posts and have them show up in the REST Api Version 2 endpoint. I can get the individual fields to show with the .mp3 file on it but I was unable to get all of the files to show in the endpoint.
I visited this URL: hidden link
I expected to see: wpcf-firstbead with an array or object - not sure how the fields are stored in toolset's "multiple instances" option.
I don't have any experience with the REST API myself, but I think I may have spotted your problem.
Types repeating fields simply adds multiple instances of the custom field to the wp_postmeta table, i.e. it creates multiple occurrences with the same meta_key.
get_post_meta takes 3 arguments, the last of which is a boolean to specify whether to return a single value, and you have this set to true. Setting it to false will return an array of all instances instead of a string of the first one.
The forum ‘Types Community Support’ is closed to new topics and replies.