Hello, I am referring to the ticket I opened a while ago https://toolset.com/forums/topic/customize-the-field-displayed-in-cpt-page-to-relate-cpts/.
Christian was so nice to guide me through, step by step, in order to find a solution to my problem, and he provided a custom code snippet, that now is being signaled by Toolset as a potential problem in relationship migrating from 2.x to 3.0.
Here is the code:
add_action('cred_save_data', 'cred_belongs_impresa_action',10,2);
function cred_belongs_impresa_action($post_id, $form_data)
{
$forms = array( 196, 230 );
// if a specific form
if (in_array($form_data['id'], $forms))
{
if (isset($_POST['selectcompany']))
{
update_post_meta( $post_id, '_wpcf_belongs_impresa_id', $_POST['selectcompany'] );
}
}
}
I would like to receive help in order to update this code. Thank you!
Hi, this code should be fine in the new system. We built in backwards compatibility to handle code like this, so you should be able to migrate without any changes. After migrating, you can test by submitting the new post Form with a specific parent selected. Then in wp-admin, check the parent and child posts to ensure the relationship was created successfully. Then submit the edit post Form with a different parent selected and check wp-admin again. If either of these was unsuccessful, we need to do some deeper investigation.
Thank you Chris for the quick response.
I will try and run the migration and let you know of possible problems. Please keep this ticket open until I have performed a few tests and can report.
Thanks!
Thanks, I will stand by for your input. No need to reply right now. The ticket will remain open for 30 days.
Thank you so much for your help.
I tested the script and so far it looks like it's working as efficiently as before the big update. I can close this ticket now.