Toolset version: 3.6.1
PHP: 8.3.1
WordPress: 6.7.2
Custom post: Students (slug: sutdent)
RFG: Payments (This field group connected with student)
I am using code to create student and then RFG and connect it with students.
$student_id = wp_insert_post( [
'post_type' => 'student',
'post_title' => $data['first_name'] . ' ' . $data['last_name'],
'post_status' => 'publish',
] );
$payment_entry_id = wp_insert_attachment([
'post_type' => 'payments',
'post_status' => 'publish',
'post_title' => $reg_id
]);
$connect = toolset_connect_posts('student-payments', $student_id,$payment_entry_id,);
but $connect restults [success = false, message = The element has a wrong type or a domain for this relationship]
Well - I need to check where the issue is and why the RFG entry not get connected with post.
Can you please share problem URL and admin access details and at what course of action you want to connect the RFG and what RFG items to what post. Please share all those required details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I've adjusted the code you added to your custom plugin as given under:
Code reference: plugins/jj-users-management/includes/class-jj-users-management-rest.php
Hey,
I tried your code but it did not connected the RFG with student post.
$connect = toolset_connect_posts('payments', $student_id,$payment_entry_id);
$connect returns "The element has a wrong type or a domain for this relationship." as can be seen in attachment.
I do not know why its showing you error but I can see that when I make the payment I can see the repeating field group item is attached to post.
See the following post:
- hidden link
I can see that repeating field group item there with all the repeating field group fields. Maybe you can return true or success message after the following line of code: