Tell us what you are trying to do?
I want to fetch API from Toolset
Is there any documentation that you are following?
Yes, your official documentation
Is there a similar example that we can see? hidden link
What is the link to your site? hidden link
There isn't an exact document available for the Repeating Fields Groups API. However, it utilizes a child post type to store the Repeating Fields Groups. You can use the function toolset_get_related_posts() to retrieve the child posts and then display the custom field of each child post. Here's an example:
Create a Repeating Fields Group named "my-fields-group" within the post type "my-cpt" and add some custom fields to the field group.
In your theme file single.php, include the following code:
$child_posts = toolset_get_related_posts(
get_the_ID(), //Post to query by.
'my-fields-group', //Slug of the relationship to query by
'parent', //Name of the element role to query by.
100, //Maximum number of returned results
0, //Result offset
array(),//Additional query arguments
'post_id', //Determines return type
'child' // which posts from the relationship should be returned
);
var_dump($child_posts);
As you can check, the last parameter is set to "child," which enables you to query the child posts of the current post.
Hello, I found the documentation that has the explanation for the output of repeatable fields in Toolset. It said that if the field is repeatable, it will display an array. But it doesn't displayed on my end.
I checked the documentation link you sent and although demonstrated how the repeatable groups would be printed if available in the output, the issue is probably because the available Toolset REST integration options are primarily focused on simple custom fields.
With regard to repeatable field groups, it's essential to understand that they are hidden custom post types, joined by a hidden one-to-many relationship with the parent post type. I'm afraid that Toolset does not provide a built-in mechanism for exposing the relationships through the REST API. To achieve this, you will need to extend the capabilities of the WordPress API and query the data using the relationship API. You can refer to the following resources for further guidance: