Skip Navigation

[Resolved] Importing relationship using CSV Importer Custom fields Pro

This support ticket is created 6 years, 11 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.

Our next available supporter will start replying to tickets in about 8.12 hours from now. Thank you for your understanding.

This topic contains 1 reply, has 1 voice.

Last updated by leonardoL 6 years, 11 months ago.

Author
Posts
#600418

Hi I'm trying to import the id values with CSV Importer Custom fields Pro (_wpcf_belongs_obra_id) but it doesn't work.

The parent is obra and the child is fotografia, I tried using a custom field and some scripts that I found here but nothing.

This script works but only for the first 5 post,

require "wp-config.php";
$childs = get_posts('post_type=fotografia');
foreach ($childs as $child) {
$old_id = get_post_meta($child->ID, 'wpcf-relacionobra', true);
$parents = get_posts('post_type=obra&meta_key=id-relacion&meta_value=' . $old_id);
update_post_meta($child->ID, '_wpcf_belongs_obra_id', $parents[0]->ID);
}

Could you help me please?

#600598

Solved by plugin developer.