Problem:
The user would like to expose some related posts as a field in the REST API responses.
Solution:
I run a small test and I found out that the issue in your code is the dash in the REST field name "parent-page", the code works with an underscore "parent_page". Check this screenshot http://prntscr.com/vr8azl
I used the following and slugs:
Parent slug: "parent-cpt".
Child slug: "child-cpt".
Relationship slug:
function get_parent_page_for_api_bonos( $object ) {
//get the id of the post object array
$post_id = $object['id'];
//return the post meta
return toolset_get_related_post( $post_id, 'parent-cpt-child-cpt');
}
add_action( 'rest_api_init', 'create_api_posts_meta_field_bonos');
function create_api_posts_meta_field_bonos() {
register_rest_field(
'child-cpt',
'parent_page',
array(
'get_callback' => 'get_parent_page_for_api_bonos',
'schema' => null,
)
);
}
Problem:
I have to choose a CSV importer plugin for a project.
The site has an items catalog build with Toolset CPT and custom fields.
The items CPT uses custom fields and repeatable groups.
Will support multiple languages (planned on using WPML).
From reading the docs WP All Import Plugin and WP Ultimate CSV Importer are the two best choices, they both claim to support relationships and repeatable field groups.
Any reason to choose one or the other? Pros and Cons in how they play nice with Toolset?
Let me know any other info about the site that might be useful to keep in consideration.
I would like to aggregate all of the child posts that are published under the same parent posts where a user also has a child post... But users are able to create child posts under multiple parent posts. So, this view would need to show all of the child posts from each of the parent posts where they have also created child posts. Is this possible?