Skip Navigation

[Resolved] Help with migrating custom code provided by Support

This thread is resolved. Here is a description of the problem and solution.

Problem: I have some post relationships custom code in place on my site, and the migration process indicates that it may cause problems.

Solution: It's a good idea to check with support for migrating relationship code. This code should be okay, because we built in backwards compatibility for this particular case.

This support ticket is created 5 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by Silvia 5 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#924126

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!

#924260

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.

#924582

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!

#947802

Thanks, I will stand by for your input. No need to reply right now. The ticket will remain open for 30 days.

#953495

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.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.